From 0381c5df2976bc590c8d64fbb7aa2adbf23a6d8a Mon Sep 17 00:00:00 2001 From: Michael Nelson Date: Tue, 28 Feb 2023 16:30:51 +1100 Subject: [PATCH 01/20] WIP Signed-off-by: Michael Nelson --- dashboard/package.json | 2 +- .../src/shared/KubeappsGrpcClient.test.ts | 195 +++++++++--------- dashboard/src/shared/KubeappsGrpcClient.ts | 93 ++++----- 3 files changed, 144 insertions(+), 146 deletions(-) diff --git a/dashboard/package.json b/dashboard/package.json index 65027d7b289..a1c904ae786 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -139,7 +139,7 @@ "!src/**/*.d.ts" ], "transformIgnorePatterns": [ - "node_modules/(?!@cds|@clr|@lit|axios|bail|ccount|cds|character-entities|comma-separated-tokens|decode-named-character-reference|escape-string-regexp|hast-util-whitespace|is-plain-obj|lit|lodash-es|markdown-table|mdast-util-definitions|mdast-util-find-and-replace|mdast-util-from-markdown|mdast-util-gfm-autolink-literal|mdast-util-gfm|mdast-util-to-hast|mdast-util-to-markdown|mdast-util-to-string|micromark-core-commonmark|monaco-editor|react-monaco-editor|micromark|parse-entities|property-information|ramda|react-markdown|react-syntax-highlighter|remark-breaks|remark-gfm|remark-parse|remark-rehype|space-separated-tokens|swagger-client|swagger-ui-react|trim-lines|trough|unified|unist-builder|unist-util-generated|unist-util-is|unist-util-position|unist-util-stringify-position|unist-util-visit-parents|unist-util-visit|util-find-and-replace|vfile-message|vfile|.*css)" + "node_modules/(?!@cds|@clr|@lit|@bufbuild|axios|bail|ccount|cds|character-entities|comma-separated-tokens|decode-named-character-reference|escape-string-regexp|hast-util-whitespace|is-plain-obj|lit|lodash-es|markdown-table|mdast-util-definitions|mdast-util-find-and-replace|mdast-util-from-markdown|mdast-util-gfm-autolink-literal|mdast-util-gfm|mdast-util-to-hast|mdast-util-to-markdown|mdast-util-to-string|micromark-core-commonmark|monaco-editor|react-monaco-editor|micromark|parse-entities|property-information|ramda|react-markdown|react-syntax-highlighter|remark-breaks|remark-gfm|remark-parse|remark-rehype|space-separated-tokens|swagger-client|swagger-ui-react|trim-lines|trough|unified|unist-builder|unist-util-generated|unist-util-is|unist-util-position|unist-util-stringify-position|unist-util-visit-parents|unist-util-visit|util-find-and-replace|vfile-message|vfile|.*css)" ] }, "browserslist": { diff --git a/dashboard/src/shared/KubeappsGrpcClient.test.ts b/dashboard/src/shared/KubeappsGrpcClient.test.ts index 61d968a8ab3..c173638e311 100644 --- a/dashboard/src/shared/KubeappsGrpcClient.test.ts +++ b/dashboard/src/shared/KubeappsGrpcClient.test.ts @@ -1,20 +1,17 @@ // Copyright 2021-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { grpc } from "@improbable-eng/grpc-web"; -import { FakeTransportBuilder } from "@improbable-eng/grpc-web-fake-transport"; import { KubeappsGrpcClient } from "./KubeappsGrpcClient"; describe("kubeapps grpc client creation", () => { - const fakeEmptyTransport = new FakeTransportBuilder().withMessages([]).build(); it("should create a kubeapps grpc client", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeEmptyTransport); + const kubeappsGrpcClient = new KubeappsGrpcClient(); expect(kubeappsGrpcClient).not.toBeNull(); }); it("should create the clients for each core service", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeEmptyTransport); + const kubeappsGrpcClient = new KubeappsGrpcClient(); const serviceClients = [ kubeappsGrpcClient.getPluginsServiceClientImpl(), kubeappsGrpcClient.getPackagesServiceClientImpl(), @@ -25,7 +22,7 @@ describe("kubeapps grpc client creation", () => { }); it("should create the clients for each plugin service", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeEmptyTransport); + const kubeappsGrpcClient = new KubeappsGrpcClient(); const packagesServiceClients = [ kubeappsGrpcClient.getHelmPackagesServiceClientImpl(), kubeappsGrpcClient.getKappControllerPackagesServiceClientImpl(), @@ -41,96 +38,96 @@ describe("kubeapps grpc client creation", () => { }); }); -describe("kubeapps grpc core plugin service", () => { - afterEach(() => { - jest.restoreAllMocks(); - }); - - const fakeErrorransport = new FakeTransportBuilder() - .withPreTrailersError(grpc.Code.Internal, "boom") - .build(); - const fakeUnauthenticatedTransport = new FakeTransportBuilder() - .withPreTrailersError(grpc.Code.Unauthenticated, "you shall not pass") - .build(); - const fakeAuthTransport = new FakeTransportBuilder() - .withHeaders(new grpc.Metadata({ authorization: "Bearer topsecret" })) - .build(); - - it("it fails when an internal error is thrown", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeErrorransport); - const getPluginsServiceClientImpl = kubeappsGrpcClient.getPluginsServiceClientImpl(); - const getConfiguredPlugins = getPluginsServiceClientImpl.GetConfiguredPlugins({}); - await expect(getConfiguredPlugins).rejects.toThrowError("boom"); - }); - - it("it fails when unauthenticated", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeUnauthenticatedTransport); - const getPluginsServiceClientImpl = kubeappsGrpcClient.getPluginsServiceClientImpl(); - const getConfiguredPlugins = getPluginsServiceClientImpl.GetConfiguredPlugins({}); - await expect(getConfiguredPlugins).rejects.toThrowError("you shall not pass"); - }); - - it("it set the metadata if using token auth", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); - jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue("topsecret"); - - const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); - kubeappsGrpcClient.getPluginsServiceClientImpl(); - const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); - expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); - }); - - it("it doesn't set the metadata if not using token auth", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); - jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); - - const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); - kubeappsGrpcClient.getPluginsServiceClientImpl(); - expect(getClientMetadataMock.mock.results[0].value).toBeUndefined(); - }); - - // TODO(agamez): try to also mock the messages using the new FakeTransportBuilder().withMessages([]) - // More details: https://github.com/vmware-tanzu/kubeapps/issues/3165#issuecomment-882944035 -}); - -describe("kubeapps grpc resources plugin service", () => { - afterEach(() => { - jest.restoreAllMocks(); - }); - - const fakeAuthTransport = new FakeTransportBuilder() - .withHeaders(new grpc.Metadata({ authorization: "Bearer topsecret" })) - .build(); - - it("it set the metadata if using token auth", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); - jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue("topsecret"); - - const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); - kubeappsGrpcClient.getResourcesServiceClientImpl(); - - const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); - expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); - }); - - it("it doesn't set the metadata if not using token auth", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); - jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); - const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); - - kubeappsGrpcClient.getResourcesServiceClientImpl(); - - expect(getClientMetadataMock.mock.results[0].value).toBeUndefined(); - }); - - it("it sets the metadata if passed an explicit token", async () => { - const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); - jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); - const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); - - kubeappsGrpcClient.getResourcesServiceClientImpl("topsecret"); - - const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); - expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); - }); -}); +// describe("kubeapps grpc core plugin service", () => { +// afterEach(() => { +// jest.restoreAllMocks(); +// }); +// +// const fakeErrorransport = new FakeTransportBuilder() +// .withPreTrailersError(grpc.Code.Internal, "boom") +// .build(); +// const fakeUnauthenticatedTransport = new FakeTransportBuilder() +// .withPreTrailersError(grpc.Code.Unauthenticated, "you shall not pass") +// .build(); +// const fakeAuthTransport = new FakeTransportBuilder() +// .withHeaders(new grpc.Metadata({ authorization: "Bearer topsecret" })) +// .build(); +// +// it("it fails when an internal error is thrown", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeErrorransport); +// const getPluginsServiceClientImpl = kubeappsGrpcClient.getPluginsServiceClientImpl(); +// const getConfiguredPlugins = getPluginsServiceClientImpl.GetConfiguredPlugins({}); +// await expect(getConfiguredPlugins).rejects.toThrowError("boom"); +// }); +// +// it("it fails when unauthenticated", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeUnauthenticatedTransport); +// const getPluginsServiceClientImpl = kubeappsGrpcClient.getPluginsServiceClientImpl(); +// const getConfiguredPlugins = getPluginsServiceClientImpl.GetConfiguredPlugins({}); +// await expect(getConfiguredPlugins).rejects.toThrowError("you shall not pass"); +// }); +// +// it("it set the metadata if using token auth", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); +// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue("topsecret"); +// +// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); +// kubeappsGrpcClient.getPluginsServiceClientImpl(); +// const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); +// expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); +// }); +// +// it("it doesn't set the metadata if not using token auth", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); +// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); +// +// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); +// kubeappsGrpcClient.getPluginsServiceClientImpl(); +// expect(getClientMetadataMock.mock.results[0].value).toBeUndefined(); +// }); +// +// // TODO(agamez): try to also mock the messages using the new FakeTransportBuilder().withMessages([]) +// // More details: https://github.com/vmware-tanzu/kubeapps/issues/3165#issuecomment-882944035 +// }); +// +// describe("kubeapps grpc resources plugin service", () => { +// afterEach(() => { +// jest.restoreAllMocks(); +// }); +// +// const fakeAuthTransport = new FakeTransportBuilder() +// .withHeaders(new grpc.Metadata({ authorization: "Bearer topsecret" })) +// .build(); +// +// it("it set the metadata if using token auth", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); +// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue("topsecret"); +// +// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); +// kubeappsGrpcClient.getResourcesServiceClientImpl(); +// +// const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); +// expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); +// }); +// +// it("it doesn't set the metadata if not using token auth", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); +// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); +// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); +// +// kubeappsGrpcClient.getResourcesServiceClientImpl(); +// +// expect(getClientMetadataMock.mock.results[0].value).toBeUndefined(); +// }); +// +// it("it sets the metadata if passed an explicit token", async () => { +// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); +// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); +// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); +// +// kubeappsGrpcClient.getResourcesServiceClientImpl("topsecret"); +// +// const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); +// expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); +// }); +// }); diff --git a/dashboard/src/shared/KubeappsGrpcClient.ts b/dashboard/src/shared/KubeappsGrpcClient.ts index 1c7296887e0..e70e8619e62 100644 --- a/dashboard/src/shared/KubeappsGrpcClient.ts +++ b/dashboard/src/shared/KubeappsGrpcClient.ts @@ -1,67 +1,67 @@ // Copyright 2021-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 - -import { grpc } from "@improbable-eng/grpc-web"; -import { PackagesServiceClientImpl } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { RepositoriesServiceClientImpl } from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; -import { PluginsServiceClientImpl } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; -import { - FluxV2PackagesServiceClientImpl, - FluxV2RepositoriesServiceClientImpl, -} from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2"; +import { useMemo } from "react"; +import { ServiceType } from "@bufbuild/protobuf"; import { - HelmPackagesServiceClientImpl, - HelmRepositoriesServiceClientImpl, -} from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm"; + createGrpcWebTransport, +} from "@bufbuild/connect-web"; import { - KappControllerPackagesServiceClientImpl, - KappControllerRepositoriesServiceClientImpl, -} from "gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller"; -import { - GrpcWebImpl, - ResourcesServiceClientImpl, -} from "gen/kubeappsapis/plugins/resources/v1alpha1/resources"; + createPromiseClient, + Interceptor, + PromiseClient, + Transport, +} from "@bufbuild/connect"; +import { PackagesService } from "gen/kubeappsapis/core/packages/v1alpha1/packages_connect"; +import { RepositoriesService } from "gen/kubeappsapis/core/packages/v1alpha1/repositories_connect"; +import { PluginsService } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_connect"; +import { ResourcesService } from "gen/kubeappsapis/plugins/resources/v1alpha1/resources_connect"; +import { HelmPackagesService, HelmRepositoriesService } from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm_connect"; +import { KappControllerPackagesService, KappControllerRepositoriesService } from "gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller_connect"; +import { FluxV2PackagesService, FluxV2RepositoriesService } from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2_connect"; + import { Auth } from "./Auth"; import * as URL from "./url"; export class KubeappsGrpcClient { - private transport: grpc.TransportFactory; + private transport: Transport; - constructor(transport?: grpc.TransportFactory) { - this.transport = transport ?? grpc.CrossBrowserHttpTransport({}); + // Creates a client with a transport, ensuring the transport includes the auth header. + constructor(transport?: Transport, token?: string) { + const auth: Interceptor = (next) => async (req) => { + let t = token ? token : Auth.getAuthToken(); + if (t) { + req.header.set("Authorization", t); + } + return await next(req); + }; + this.transport = transport ?? createGrpcWebTransport({ + baseUrl: `/${URL.api.kubeappsapis}`, + interceptors: [auth], + }); } // getClientMetadata, if using token authentication, creates grpc metadata // and the token in the 'authorization' field public getClientMetadata(token?: string) { - if (token) { - return new grpc.Metadata({ authorization: `Bearer ${token}` }); - } - - return Auth.getAuthToken() - ? new grpc.Metadata({ authorization: `Bearer ${Auth.getAuthToken()}` }) - : undefined; + let t = token ? token : Auth.getAuthToken(); + return t ? new Headers({ "Authorization": `Bearer ${t}` }) : undefined; } - // getGrpcClient returns a grpc client - public getGrpcClient = (token?: string) => { - return new GrpcWebImpl(URL.api.kubeappsapis, { - transport: this.transport, - metadata: this.getClientMetadata(token), - }); - }; + public getGrpcClient = (service: T): PromiseClient => { + return useMemo(() => createPromiseClient(service, this.transport), [service]); + } // Core APIs public getPackagesServiceClientImpl() { - return new PackagesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(PackagesService); } public getRepositoriesServiceClientImpl() { - return new RepositoriesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(RepositoriesService); } public getPluginsServiceClientImpl() { - return new PluginsServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(PluginsService); } // Resources API @@ -69,8 +69,9 @@ export class KubeappsGrpcClient { // The resources API client implementation takes an optional token // only because it is used to validate token authentication before // the token is stored. + // TODO: investigate the token here. public getResourcesServiceClientImpl(token?: string) { - return new ResourcesServiceClientImpl(this.getGrpcClient(token)); + return this.getGrpcClient(ResourcesService); } // Plugins (packages/repositories) APIs @@ -78,25 +79,25 @@ export class KubeappsGrpcClient { // Helm public getHelmPackagesServiceClientImpl() { - return new HelmPackagesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(HelmPackagesService); } public getHelmRepositoriesServiceClientImpl() { - return new HelmRepositoriesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(HelmRepositoriesService); } // KappController public getKappControllerPackagesServiceClientImpl() { - return new KappControllerPackagesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(KappControllerPackagesService); } public getKappControllerRepositoriesServiceClientImpl() { - return new KappControllerRepositoriesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(KappControllerRepositoriesService); } // Fluxv2 public getFluxv2PackagesServiceClientImpl() { - return new FluxV2PackagesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(FluxV2PackagesService); } public getFluxV2RepositoriesServiceClientImpl() { - return new FluxV2RepositoriesServiceClientImpl(this.getGrpcClient()); + return this.getGrpcClient(FluxV2RepositoriesService); } } From e0e6626275d45d4be6bd59cad3a2ecd9aed41ba4 Mon Sep 17 00:00:00 2001 From: Michael Nelson Date: Thu, 2 Mar 2023 11:27:13 +1100 Subject: [PATCH 02/20] Switch dashboard to buf connect grpc web client. Signed-off-by: Michael Nelson --- dashboard/src/shared/Auth.test.ts | 34 +++---- dashboard/src/shared/Auth.ts | 18 ++-- .../src/shared/KubeappsGrpcClient.test.ts | 94 ------------------- dashboard/src/shared/KubeappsGrpcClient.ts | 3 +- dashboard/src/shared/utils.ts | 36 +++---- 5 files changed, 45 insertions(+), 140 deletions(-) diff --git a/dashboard/src/shared/Auth.test.ts b/dashboard/src/shared/Auth.test.ts index f18572b89c6..a46ef6183f2 100644 --- a/dashboard/src/shared/Auth.test.ts +++ b/dashboard/src/shared/Auth.test.ts @@ -1,7 +1,7 @@ // Copyright 2019-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { grpc } from "@improbable-eng/grpc-web"; +import { Code } from "@bufbuild/connect"; import { AxiosResponse } from "axios"; import { CheckNamespaceExistsRequest } from "gen/kubeappsapis/plugins/resources/v1alpha1/resources"; import jwt from "jsonwebtoken"; @@ -13,13 +13,13 @@ import { initialState } from "./specs/mountWrapper"; describe("Auth", () => { // Create a real client, but we'll stub out the function we're interested in. const client = new KubeappsGrpcClient().getResourcesServiceClientImpl(); - let mockClientCheckNamespaceExists: jest.MockedFunction; + let mockClientCheckNamespaceExists: jest.MockedFunction; beforeEach(() => { mockClientCheckNamespaceExists = jest .fn() .mockImplementation(() => Promise.resolve({ exists: true } as CheckNamespaceExistsRequest)); - jest.spyOn(client, "CheckNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); + jest.spyOn(client, "checkNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); jest.spyOn(Auth, "resourcesServiceClient").mockImplementation(() => client); }); afterEach(() => { @@ -41,8 +41,8 @@ describe("Auth", () => { it("should return without error when the endpoint returns PermissionDenied with the given token", async () => { mockClientCheckNamespaceExists = jest .fn() - .mockImplementation(() => Promise.reject({ code: grpc.Code.PermissionDenied })); - jest.spyOn(client, "CheckNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); + .mockImplementation(() => Promise.reject({ code: Code.PermissionDenied })); + jest.spyOn(client, "checkNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); await Auth.validateToken("othercluster", "foo"); expect(Auth.resourcesServiceClient).toHaveBeenCalledWith("foo"); @@ -59,17 +59,17 @@ describe("Auth", () => { { name: "should throw an invalid token error for 401 responses", response: { status: 401, data: "ignored anyway" }, - grpcCode: grpc.Code.Unauthenticated, + grpcCode: Code.Unauthenticated, expectedError: new Error("invalid token"), }, { name: "should throw a standard error for a 404 response", - grpcCode: grpc.Code.NotFound, + grpcCode: Code.NotFound, expectedError: new Error("not found"), }, { name: "should throw a standard error for a 500 response", - grpcCode: grpc.Code.Internal, + grpcCode: Code.Internal, expectedError: new Error("internal error"), }, ].forEach(testCase => { @@ -78,7 +78,7 @@ describe("Auth", () => { .fn() .mockImplementation(() => Promise.reject({ code: testCase.grpcCode })); jest - .spyOn(client, "CheckNamespaceExists") + .spyOn(client, "checkNamespaceExists") .mockImplementation(mockClientCheckNamespaceExists); await expect(Auth.validateToken("default", "foo")).rejects.toThrow(testCase.expectedError); @@ -103,7 +103,7 @@ describe("Auth", () => { it("returns false if the request results in a non-grpc-web response", async () => { mockClientCheckNamespaceExists = jest.fn().mockImplementation(() => Promise.reject({ - code: grpc.Code.PermissionDenied, + code: Code.PermissionDenied, metadata: { headersMap: { "content-type": ["not-grpc-content-type"], @@ -111,7 +111,7 @@ describe("Auth", () => { }, }), ); - jest.spyOn(client, "CheckNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); + jest.spyOn(client, "checkNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); const isAuthed = await Auth.isAuthenticatedWithCookie("somecluster"); @@ -121,7 +121,7 @@ describe("Auth", () => { it("returns true if the request to api root results in a 403", async () => { mockClientCheckNamespaceExists = jest.fn().mockImplementation(() => Promise.reject({ - code: grpc.Code.PermissionDenied, + code: Code.PermissionDenied, metadata: { headersMap: { "content-type": ["application/grpc-web+proto"], @@ -129,7 +129,7 @@ describe("Auth", () => { }, }), ); - jest.spyOn(client, "CheckNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); + jest.spyOn(client, "checkNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); const isAuthed = await Auth.isAuthenticatedWithCookie("somecluster"); @@ -139,7 +139,7 @@ describe("Auth", () => { it("returns true if the request to api root results in a 403 with another grpc protocol", async () => { mockClientCheckNamespaceExists = jest.fn().mockImplementation(() => Promise.reject({ - code: grpc.Code.PermissionDenied, + code: Code.PermissionDenied, metadata: { headersMap: { "content-type": ["application/grpc-web+thrift"], @@ -147,7 +147,7 @@ describe("Auth", () => { }, }), ); - jest.spyOn(client, "CheckNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); + jest.spyOn(client, "checkNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); const isAuthed = await Auth.isAuthenticatedWithCookie("somecluster"); @@ -156,7 +156,7 @@ describe("Auth", () => { it("returns false if the request results in a 401", async () => { mockClientCheckNamespaceExists = jest.fn().mockImplementation(() => Promise.reject({ - code: grpc.Code.Unauthenticated, + code: Code.Unauthenticated, metadata: { headersMap: { "content-type": ["not-grpc-content-type"], @@ -164,7 +164,7 @@ describe("Auth", () => { }, }), ); - jest.spyOn(client, "CheckNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); + jest.spyOn(client, "checkNamespaceExists").mockImplementation(mockClientCheckNamespaceExists); const isAuthed = await Auth.isAuthenticatedWithCookie("somecluster"); diff --git a/dashboard/src/shared/Auth.ts b/dashboard/src/shared/Auth.ts index c508be0a63f..50043fa7d62 100644 --- a/dashboard/src/shared/Auth.ts +++ b/dashboard/src/shared/Auth.ts @@ -1,7 +1,7 @@ // Copyright 2018-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { grpc } from "@improbable-eng/grpc-web"; +import { Code } from "@bufbuild/connect"; import { AxiosResponse } from "axios"; import jwt from "jsonwebtoken"; import { get } from "lodash"; @@ -57,7 +57,7 @@ export class Auth { // Trimming the b64 padding character ("=") as it is not accepted by k8s // https://github.com/kubernetes/apiserver/blob/release-1.22/pkg/authentication/request/websocket/protocol.go#L38 "base64url.bearer.authorization.k8s.io." + - Buffer.from(token).toString("base64").replaceAll("=", ""), + Buffer.from(token).toString("base64").replaceAll("=", ""), "binary.k8s.io", ]; } @@ -73,11 +73,11 @@ export class Auth { // Throws an error if the token is invalid public static async validateToken(cluster: string, token: string) { try { - await this.resourcesServiceClient(token).CheckNamespaceExists({ + await this.resourcesServiceClient(token).checkNamespaceExists({ context: { cluster, namespace: "default" }, }); } catch (e: any) { - if (e.code === grpc.Code.Unauthenticated) { + if (e.code === Code.Unauthenticated) { throw new UnauthorizedNetworkError("invalid token"); } // https://kubernetes.io/docs/reference/access-authn-authz/authentication/#anonymous-requests @@ -86,11 +86,11 @@ export class Auth { // don't make any assumptions over RBAC for the requested namespace or // other required authz permissions until operations on those resources // are attempted (though we may want to revisit this in the future). - if (e.code !== grpc.Code.PermissionDenied) { - if (e.code === grpc.Code.NotFound) { + if (e.code !== Code.PermissionDenied) { + if (e.code === Code.NotFound) { throw new NotFoundNetworkError("not found"); } - if (e.code === grpc.Code.Internal) { + if (e.code === Code.Internal) { throw new InternalServerNetworkError("internal error"); } throw new InternalServerNetworkError(`${e.code}: ${e.message}`); @@ -151,14 +151,14 @@ export class Auth { // it could potentially return a false positive. public static async isAuthenticatedWithCookie(cluster: string): Promise { try { - await this.resourcesServiceClient().CheckNamespaceExists({ + await this.resourcesServiceClient().checkNamespaceExists({ context: { cluster, namespace: "default" }, }); } catch (e: any) { // The only error response which can possibly mean we did authenticate is // a 403 from the k8s api server (ie. we got through to k8s api server // but RBAC doesn't authorize us). - if (e.code !== grpc.Code.PermissionDenied) { + if (e.code !== Code.PermissionDenied) { return false; } diff --git a/dashboard/src/shared/KubeappsGrpcClient.test.ts b/dashboard/src/shared/KubeappsGrpcClient.test.ts index c173638e311..861f2224aef 100644 --- a/dashboard/src/shared/KubeappsGrpcClient.test.ts +++ b/dashboard/src/shared/KubeappsGrpcClient.test.ts @@ -37,97 +37,3 @@ describe("kubeapps grpc client creation", () => { repositoriesServiceClients.every(sc => expect(sc).not.toBeNull()); }); }); - -// describe("kubeapps grpc core plugin service", () => { -// afterEach(() => { -// jest.restoreAllMocks(); -// }); -// -// const fakeErrorransport = new FakeTransportBuilder() -// .withPreTrailersError(grpc.Code.Internal, "boom") -// .build(); -// const fakeUnauthenticatedTransport = new FakeTransportBuilder() -// .withPreTrailersError(grpc.Code.Unauthenticated, "you shall not pass") -// .build(); -// const fakeAuthTransport = new FakeTransportBuilder() -// .withHeaders(new grpc.Metadata({ authorization: "Bearer topsecret" })) -// .build(); -// -// it("it fails when an internal error is thrown", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeErrorransport); -// const getPluginsServiceClientImpl = kubeappsGrpcClient.getPluginsServiceClientImpl(); -// const getConfiguredPlugins = getPluginsServiceClientImpl.GetConfiguredPlugins({}); -// await expect(getConfiguredPlugins).rejects.toThrowError("boom"); -// }); -// -// it("it fails when unauthenticated", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeUnauthenticatedTransport); -// const getPluginsServiceClientImpl = kubeappsGrpcClient.getPluginsServiceClientImpl(); -// const getConfiguredPlugins = getPluginsServiceClientImpl.GetConfiguredPlugins({}); -// await expect(getConfiguredPlugins).rejects.toThrowError("you shall not pass"); -// }); -// -// it("it set the metadata if using token auth", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); -// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue("topsecret"); -// -// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); -// kubeappsGrpcClient.getPluginsServiceClientImpl(); -// const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); -// expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); -// }); -// -// it("it doesn't set the metadata if not using token auth", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); -// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); -// -// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); -// kubeappsGrpcClient.getPluginsServiceClientImpl(); -// expect(getClientMetadataMock.mock.results[0].value).toBeUndefined(); -// }); -// -// // TODO(agamez): try to also mock the messages using the new FakeTransportBuilder().withMessages([]) -// // More details: https://github.com/vmware-tanzu/kubeapps/issues/3165#issuecomment-882944035 -// }); -// -// describe("kubeapps grpc resources plugin service", () => { -// afterEach(() => { -// jest.restoreAllMocks(); -// }); -// -// const fakeAuthTransport = new FakeTransportBuilder() -// .withHeaders(new grpc.Metadata({ authorization: "Bearer topsecret" })) -// .build(); -// -// it("it set the metadata if using token auth", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); -// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue("topsecret"); -// -// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); -// kubeappsGrpcClient.getResourcesServiceClientImpl(); -// -// const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); -// expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); -// }); -// -// it("it doesn't set the metadata if not using token auth", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); -// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); -// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); -// -// kubeappsGrpcClient.getResourcesServiceClientImpl(); -// -// expect(getClientMetadataMock.mock.results[0].value).toBeUndefined(); -// }); -// -// it("it sets the metadata if passed an explicit token", async () => { -// const kubeappsGrpcClient = new KubeappsGrpcClient(fakeAuthTransport); -// jest.spyOn(window.localStorage.__proto__, "getItem").mockReturnValue(null); -// const getClientMetadataMock = jest.spyOn(KubeappsGrpcClient.prototype, "getClientMetadata"); -// -// kubeappsGrpcClient.getResourcesServiceClientImpl("topsecret"); -// -// const expectedMetadata = new grpc.Metadata({ authorization: "Bearer topsecret" }); -// expect(getClientMetadataMock.mock.results[0].value).toEqual(expectedMetadata); -// }); -// }); diff --git a/dashboard/src/shared/KubeappsGrpcClient.ts b/dashboard/src/shared/KubeappsGrpcClient.ts index e70e8619e62..251967a1797 100644 --- a/dashboard/src/shared/KubeappsGrpcClient.ts +++ b/dashboard/src/shared/KubeappsGrpcClient.ts @@ -1,6 +1,5 @@ // Copyright 2021-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { useMemo } from "react"; import { ServiceType } from "@bufbuild/protobuf"; import { createGrpcWebTransport, @@ -48,7 +47,7 @@ export class KubeappsGrpcClient { } public getGrpcClient = (service: T): PromiseClient => { - return useMemo(() => createPromiseClient(service, this.transport), [service]); + return createPromiseClient(service, this.transport); } // Core APIs diff --git a/dashboard/src/shared/utils.ts b/dashboard/src/shared/utils.ts index 43d8fc7c13f..69d5f1a9a2f 100644 --- a/dashboard/src/shared/utils.ts +++ b/dashboard/src/shared/utils.ts @@ -1,7 +1,7 @@ // Copyright 2018-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { grpc } from "@improbable-eng/grpc-web"; +import { Code } from "@bufbuild/connect"; import { InstalledPackageStatus_StatusReason, installedPackageStatus_StatusReasonToJSON, @@ -359,9 +359,9 @@ export function getGlobalNamespaceOrNamespace( export function convertGrpcAuthError(e: any): CustomError | any { const msg = e?.metadata?.headersMap?.["grpc-message"].toString(); switch (e?.code) { - case grpc.Code.Unauthenticated: + case Code.Unauthenticated: return new UnauthorizedNetworkError(msg); - case grpc.Code.FailedPrecondition: + case Code.FailedPrecondition: // Use `FAILED_PRECONDITION` if the client should not retry until the system state has been explicitly fixed. //TODO(agamez): this code shouldn't be returned by the API, but it is if (["credentials", "unauthorized"].some(p => msg?.toLowerCase()?.includes(p))) { @@ -369,42 +369,42 @@ export function convertGrpcAuthError(e: any): CustomError | any { } else { return new BadRequestNetworkError(msg); } - case grpc.Code.Internal: + case Code.Internal: //TODO(agamez): this code shouldn't be returned by the API, but it is if (["credentials", "unauthorized"].some(p => msg?.toLowerCase()?.includes(p))) { return new UnauthorizedNetworkError(msg); } else { return new InternalServerNetworkError(msg); } - case grpc.Code.PermissionDenied: + case Code.PermissionDenied: return new ForbiddenNetworkError(msg); - case grpc.Code.NotFound: + case Code.NotFound: return new NotFoundNetworkError(msg); - case grpc.Code.AlreadyExists: + case Code.AlreadyExists: return new ConflictNetworkError(msg); - case grpc.Code.InvalidArgument: + case Code.InvalidArgument: return new BadRequestNetworkError(msg); - case grpc.Code.DeadlineExceeded: + case Code.DeadlineExceeded: return new GatewayTimeoutNetworkError(msg); - case grpc.Code.ResourceExhausted: + case Code.ResourceExhausted: return new TooManyRequestsNetworkError(msg); - case grpc.Code.Aborted: + case Code.Aborted: // Use `ABORTED` if the client should retry at a higher level return new ConflictNetworkError(msg); - case grpc.Code.Unimplemented: + case Code.Unimplemented: return new NotImplementedNetworkError(msg); - case grpc.Code.OutOfRange: + case Code.OutOfRange: return new BadRequestNetworkError(msg); - case grpc.Code.Unavailable: + case Code.Unavailable: // Use `UNAVAILABLE` if the client can retry just the failing call. return new ServerUnavailableNetworkError(msg); - case grpc.Code.DataLoss: + case Code.DataLoss: return new InternalServerNetworkError(msg); - case grpc.Code.Unknown: + case Code.Unknown: return new InternalServerNetworkError(msg); - case grpc.Code.Canceled: + case Code.Canceled: return new RequestTimeoutNetworkError(msg); - case grpc.Code.OK: + case Code.OK: return undefined; default: return e; From fb90b8feaa2f8ec77c8562aa9186959d624b1ac4 Mon Sep 17 00:00:00 2001 From: Michael Nelson Date: Thu, 2 Mar 2023 11:37:13 +1100 Subject: [PATCH 03/20] Remove improbable from dashboard. Signed-off-by: Michael Nelson --- cmd/kubeapps-apis/buf.gen.yaml | 10 - .../core/packages/v1alpha1/packages.ts | 4716 ----------------- .../core/packages/v1alpha1/repositories.ts | 3487 ------------ .../core/plugins/v1alpha1/plugins.ts | 396 -- .../fluxv2/packages/v1alpha1/fluxv2.ts | 870 --- .../plugins/helm/packages/v1alpha1/helm.ts | 1997 ------- .../packages/v1alpha1/kapp_controller.ts | 1890 ------- .../plugins/resources/v1alpha1/resources.ts | 2168 -------- dashboard/src/shared/Auth.ts | 2 +- .../src/shared/KubeappsGrpcClient.test.ts | 1 - dashboard/src/shared/KubeappsGrpcClient.ts | 42 +- 11 files changed, 24 insertions(+), 15555 deletions(-) delete mode 100644 dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/packages.ts delete mode 100644 dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/repositories.ts delete mode 100644 dashboard/src/gen/kubeappsapis/core/plugins/v1alpha1/plugins.ts delete mode 100644 dashboard/src/gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2.ts delete mode 100644 dashboard/src/gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm.ts delete mode 100644 dashboard/src/gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller.ts delete mode 100644 dashboard/src/gen/kubeappsapis/plugins/resources/v1alpha1/resources.ts diff --git a/cmd/kubeapps-apis/buf.gen.yaml b/cmd/kubeapps-apis/buf.gen.yaml index 2965d52e2af..c2464679014 100644 --- a/cmd/kubeapps-apis/buf.gen.yaml +++ b/cmd/kubeapps-apis/buf.gen.yaml @@ -41,16 +41,6 @@ plugins: - allow_merge=true - merge_file_name=kubeapps-apis - allow_repeated_fields_in_body=true - # ts_proto plugin generates the typescript grpc-web compliant client for each operation - # See https://github.com/stephenh/ts-proto - - name: ts_proto - path: ../../dashboard/node_modules/.bin/protoc-gen-ts_proto - out: ../../dashboard/src/gen - strategy: all - opt: - - outputClientImpl=grpc-web # client implementation it generates - - esModuleInterop=true # use imports as required in modern ts setups - - useOptionals=messages # use optional TypeScript properties instead of undefined - name: es opt: - target=ts diff --git a/dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/packages.ts b/dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/packages.ts deleted file mode 100644 index 30c7a7b8131..00000000000 --- a/dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/packages.ts +++ /dev/null @@ -1,4716 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import _m0 from "protobufjs/minimal"; -import { Any } from "../../../../google/protobuf/any"; -import { Plugin } from "../../plugins/v1alpha1/plugins"; - -export const protobufPackage = "kubeappsapis.core.packages.v1alpha1"; - -/** - * GetAvailablePackageSummariesRequest - * - * Request for GetAvailablePackageSummaries - */ -export interface GetAvailablePackageSummariesRequest { - /** The context (cluster/namespace) for the request */ - context?: Context; - /** The filters used for the request */ - filterOptions?: FilterOptions; - /** Pagination options specifying where to start and how many results to include. */ - paginationOptions?: PaginationOptions; -} - -/** - * GetAvailablePackageDetailRequest - * - * Request for GetAvailablePackageDetail - */ -export interface GetAvailablePackageDetailRequest { - /** - * The information required to uniquely - * identify an available package - */ - availablePackageRef?: AvailablePackageReference; - /** - * Optional specific version (or version reference) to request. - * By default the latest version (or latest version matching the reference) - * will be returned. - */ - pkgVersion: string; -} - -/** - * GetAvailablePackageVersionsRequest - * - * Request for GetAvailablePackageVersions - */ -export interface GetAvailablePackageVersionsRequest { - /** - * The information required to uniquely - * identify an available package - */ - availablePackageRef?: AvailablePackageReference; - /** - * Optional version reference for which full version history is required. By - * default a summary of versions is returned as outlined in the response. - * Plugins can choose not to implement this and provide the summary only, it - * is provided for completeness only. - */ - pkgVersion: string; -} - -/** - * GetInstalledPackageSummariesRequest - * - * Request for GetInstalledPackageSummaries - */ -export interface GetInstalledPackageSummariesRequest { - /** The context (cluster/namespace) for the request. */ - context?: Context; - /** Pagination options specifying where to start and how many results to include. */ - paginationOptions?: PaginationOptions; -} - -/** - * GetInstalledPackageDetailRequest - * - * Request for GetInstalledPackageDetail - */ -export interface GetInstalledPackageDetailRequest { - /** - * The information required to uniquely - * identify an installed package - */ - installedPackageRef?: InstalledPackageReference; -} - -/** - * CreateInstalledPackageRequest - * - * Request for CreateInstalledPackage - */ -export interface CreateInstalledPackageRequest { - /** A reference uniquely identifying the package available for installation. */ - availablePackageRef?: AvailablePackageReference; - /** The target context where the package is intended to be installed. */ - targetContext?: Context; - /** A user-provided name for the installed package (eg. project-x-db) */ - name: string; - /** - * For helm this will be the exact version in VersionReference.version - * For other plugins we can extend the VersionReference as needed. - */ - pkgVersionReference?: VersionReference; - /** - * An optional serialized values string to be included when templating a package - * in the format expected by the plugin. Included when the backend format doesn't - * use secrets or configmaps for values or supports both. These values are layered - * on top of any values refs above, when relevant. - */ - values: string; - /** - * An optional field for specifying data common to systems that reconcile - * the package on the cluster. - */ - reconciliationOptions?: ReconciliationOptions; -} - -/** - * UpdateInstalledPackageRequest - * - * Request for UpdateInstalledPackage. The intent is to reach the desired state specified - * by the fields in the request, while leaving other fields intact. This is a whole - * object "Update" semantics rather than "Patch" semantics. The caller will provide the - * values for the fields below, which will replace, or be overlaid onto, the - * corresponding fields in the existing resource. For example, with the - * UpdateInstalledPackageRequest, it is not possible to change just the 'package version - * reference' without also specifying 'values' field. As a side effect, not specifying the - * 'values' field in the request means there are no values specified in the desired state. - * So the meaning of each field value is describing the desired state of the corresponding - * field in the resource after the update operation has completed the renconciliation. - */ -export interface UpdateInstalledPackageRequest { - /** - * A reference uniquely identifying the installed package being updated. - * Required - */ - installedPackageRef?: InstalledPackageReference; - /** - * For helm this will be the exact version in VersionReference.version - * For fluxv2 this could be any semver constraint expression - * For other plugins we can extend the VersionReference as needed. Optional - */ - pkgVersionReference?: VersionReference; - /** - * An optional serialized values string to be included when templating a - * package in the format expected by the plugin. Included when the backend - * format doesn't use secrets or configmaps for values or supports both. - * These values are layered on top of any values refs above, when - * relevant. - */ - values: string; - /** - * An optional field for specifying data common to systems that reconcile - * the package on the cluster. - */ - reconciliationOptions?: ReconciliationOptions; -} - -/** - * DeleteInstalledPackageRequest - * - * Request for DeleteInstalledPackage - */ -export interface DeleteInstalledPackageRequest { - /** A reference to uniquely identify the installed package to be deleted. */ - installedPackageRef?: InstalledPackageReference; -} - -/** - * GetInstalledPackageResourceRefsRequest - * - * Request for GetInstalledPackageResourceRefs - */ -export interface GetInstalledPackageResourceRefsRequest { - installedPackageRef?: InstalledPackageReference; -} - -/** - * GetAvailablePackageSummariesResponse - * - * Response for GetAvailablePackageSummaries - */ -export interface GetAvailablePackageSummariesResponse { - /** - * Available packages summaries - * - * List of AvailablePackageSummary - */ - availablePackageSummaries: AvailablePackageSummary[]; - /** - * Next page token - * - * This field represents the pagination token to retrieve the next page of - * results. If the value is "", it means no further results for the request. - */ - nextPageToken: string; - /** - * Categories - * - * This optional field contains the distinct category names considering the FilterOptions. - */ - categories: string[]; -} - -/** - * GetAvailablePackageDetailResponse - * - * Response for GetAvailablePackageDetail - */ -export interface GetAvailablePackageDetailResponse { - /** - * Available package detail - * - * The requested AvailablePackageDetail - */ - availablePackageDetail?: AvailablePackageDetail; -} - -/** - * GetAvailablePackageVersionsResponse - * - * Response for GetAvailablePackageVersions - */ -export interface GetAvailablePackageVersionsResponse { - /** - * Package app versions - * - * By default (when version_query is empty or ignored) the response - * should contain an ordered summary of versions including the most recent three - * patch versions of the most recent three minor versions of the most recent three - * major versions when available, something like: - * [ - * { pkg_version: "10.3.19", app_version: "2.16.8" }, - * { pkg_version: "10.3.18", app_version: "2.16.8" }, - * { pkg_version: "10.3.17", app_version: "2.16.7" }, - * { pkg_version: "10.2.6", app_version: "2.15.3" }, - * { pkg_version: "10.2.5", app_version: "2.15.2" }, - * { pkg_version: "10.2.4", app_version: "2.15.2" }, - * { pkg_version: "10.1.8", app_version: "2.13.5" }, - * { pkg_version: "10.1.7", app_version: "2.13.5" }, - * { pkg_version: "10.1.6", app_version: "2.13.5" }, - * { pkg_version: "9.5.4", app_version: "2.8.9" }, - * ... - * { pkg_version: "8.2.5", app_version: "1.19.5" }, - * ... - * ] - * If a version_query is present and the plugin chooses to support it, - * the full history of versions matching the version query should be returned. - */ - packageAppVersions: PackageAppVersion[]; -} - -/** - * GetInstalledPackageSummariesResponse - * - * Response for GetInstalledPackageSummaries - */ -export interface GetInstalledPackageSummariesResponse { - /** - * Installed packages summaries - * - * List of InstalledPackageSummary - */ - installedPackageSummaries: InstalledPackageSummary[]; - /** - * Next page token - * - * This field represents the pagination token to retrieve the next page of - * results. If the value is "", it means no further results for the request. - */ - nextPageToken: string; -} - -/** - * GetInstalledPackageDetailResponse - * - * Response for GetInstalledPackageDetail - */ -export interface GetInstalledPackageDetailResponse { - /** - * InstalledPackageDetail - * - * The requested InstalledPackageDetail - */ - installedPackageDetail?: InstalledPackageDetail; -} - -/** - * CreateInstalledPackageResponse - * - * Response for CreateInstalledPackage - */ -export interface CreateInstalledPackageResponse { - installedPackageRef?: InstalledPackageReference; -} - -/** - * UpdateInstalledPackageResponse - * - * Response for UpdateInstalledPackage - */ -export interface UpdateInstalledPackageResponse { - installedPackageRef?: InstalledPackageReference; -} - -/** - * DeleteInstalledPackageResponse - * - * Response for DeleteInstalledPackage - */ -export interface DeleteInstalledPackageResponse {} - -/** - * GetInstalledPackageResourceRefsResponse - * - * Response for GetInstalledPackageResourceRefs - */ -export interface GetInstalledPackageResourceRefsResponse { - context?: Context; - resourceRefs: ResourceRef[]; -} - -/** - * AvailablePackageSummary - * - * An AvailablePackageSummary provides a summary of a package available for installation - * useful when aggregating many available packages. - */ -export interface AvailablePackageSummary { - /** - * Available package reference - * - * A reference uniquely identifying the package. - */ - availablePackageRef?: AvailablePackageReference; - /** - * Available package name - * - * The name of the available package - */ - name: string; - /** - * Latest available version - * - * The latest version available for this package. Often expected when viewing - * a summary of many available packages. - */ - latestVersion?: PackageAppVersion; - /** - * Available package Icon URL - * - * A url for an icon. - */ - iconUrl: string; - /** - * Available package display name - * - * A name as displayed to users - */ - displayName: string; - /** - * Available package short description - * - * A short description of the app provided by the package - */ - shortDescription: string; - /** - * Available package categories - * - * A user-facing list of category names useful for creating richer user interfaces. - * Plugins can choose not to implement this - */ - categories: string[]; -} - -/** - * AvailablePackageDetail - * - * An AvailablePackageDetail provides additional details required when - * inspecting an individual package. - */ -export interface AvailablePackageDetail { - /** - * Available package reference - * - * A reference uniquely identifying the package. - */ - availablePackageRef?: AvailablePackageReference; - /** - * Available package name - * - * The name of the available package - */ - name: string; - /** - * Available version - * - * The version of the package and application. - */ - version?: PackageAppVersion; - /** the url of the package repository that contains this package */ - repoUrl: string; - /** the url of the "home" for the package */ - homeUrl: string; - /** - * Available package icon URL - * - * A url for an icon. - */ - iconUrl: string; - /** - * Available package display name - * - * A name as displayed to users - */ - displayName: string; - /** - * Available package short description - * - * A short description of the app provided by the package - */ - shortDescription: string; - /** - * Available package long description - * - * A longer description of the package, a few sentences. - */ - longDescription: string; - /** - * Available package readme - * - * A longer README with potentially pages of formatted Markdown. - */ - readme: string; - /** - * Available package default values - * - * An example of default values used during package templating that can serve - * as documentation or a starting point for user customization. - */ - defaultValues: string; - /** - * Available package additional default values - * - * A package may contain additional default value files for specific scenarios, - * such as values_production.yaml or values_dev.yaml - */ - additionalDefaultValues: { [key: string]: string }; - valuesSchema: string; - /** source urls for the package */ - sourceUrls: string[]; - /** - * Available package maintainers - * - * List of Maintainer - */ - maintainers: Maintainer[]; - /** - * Available package categories - * - * A user-facing list of category names useful for creating richer user interfaces. - * Plugins can choose not to implement this - */ - categories: string[]; - /** - * Custom data added by the plugin - * - * A plugin can define custom details for data which is not yet, or never will - * be specified in the core.packaging.CreateInstalledPackageRequest fields. The use - * of an `Any` field means that each plugin can define the structure of this - * message as required, while still satisfying the core interface. - * See https://developers.google.com/protocol-buffers/docs/proto3#any - */ - customDetail?: Any; -} - -export interface AvailablePackageDetail_AdditionalDefaultValuesEntry { - key: string; - value: string; -} - -/** - * InstalledPackageSummary - * - * An InstalledPackageSummary provides a summary of an installed package - * useful when aggregating many installed packages. - */ -export interface InstalledPackageSummary { - /** - * InstalledPackageReference - * - * A reference uniquely identifying the package. - */ - installedPackageRef?: InstalledPackageReference; - /** - * Name - * - * A name given to the installation of the package (eg. "my-postgresql-for-testing"). - */ - name: string; - /** - * PkgVersionReference - * - * The package version reference defines a version or constraint limiting - * matching package versions. - */ - pkgVersionReference?: VersionReference; - /** - * CurrentVersion - * - * The current version of the package being reconciled, which may be - * in one of these states: - * - has been successfully installed/upgraded or - * - is currently being installed/upgraded or - * - has failed to install/upgrade - */ - currentVersion?: PackageAppVersion; - /** - * Installed package icon URL - * - * A url for an icon. - */ - iconUrl: string; - /** - * PackageDisplayName - * - * The package name as displayed to users (provided by the package, eg. "PostgreSQL") - */ - pkgDisplayName: string; - /** - * ShortDescription - * - * A short description of the package (provided by the package) - */ - shortDescription: string; - /** - * LatestMatchingVersion - * - * Only non-empty if an available upgrade matches the specified pkg_version_reference. - * For example, if the pkg_version_reference is ">10.3.0 < 10.4.0" and 10.3.1 - * is installed, then: - * * if 10.3.2 is available, latest_matching_version should be 10.3.2, but - * * if 10.4 is available while >10.3.1 is not, this should remain empty. - */ - latestMatchingVersion?: PackageAppVersion; - /** - * LatestVersion - * - * The latest version available for this package, regardless of the pkg_version_reference. - */ - latestVersion?: PackageAppVersion; - /** - * Status - * - * The current status of the installed package. - */ - status?: InstalledPackageStatus; -} - -/** - * InstalledPackageDetail - * - * An InstalledPackageDetail includes details about the installed package that are - * typically useful when presenting a single installed package. - */ -export interface InstalledPackageDetail { - /** - * InstalledPackageReference - * - * A reference uniquely identifying the installed package. - */ - installedPackageRef?: InstalledPackageReference; - /** - * PkgVersionReference - * - * The package version reference defines a version or constraint limiting - * matching package versions. - */ - pkgVersionReference?: VersionReference; - /** - * Installed package name - * - * The name given to the installed package - */ - name: string; - /** - * CurrentVersion - * - * The version of the package which is currently installed. - */ - currentVersion?: PackageAppVersion; - /** - * ValuesApplied - * - * The values applied currently for the installed package. - */ - valuesApplied: string; - /** - * ReconciliationOptions - * - * An optional field specifying data common to systems that reconcile - * the package installation on the cluster asynchronously. In particular, - * this specifies the service account used to perform the reconcilliation. - */ - reconciliationOptions?: ReconciliationOptions; - /** - * Status - * - * The current status of the installed package. - */ - status?: InstalledPackageStatus; - /** - * PostInstallationNotes - * - * Optional notes generated by package and intended for the user post installation. - */ - postInstallationNotes: string; - /** - * Available package reference - * - * A reference to the available package for this installation. - * Useful to lookup the package display name, icon and other info. - */ - availablePackageRef?: AvailablePackageReference; - /** - * LatestMatchingVersion - * - * Only non-empty if an available upgrade matches the specified pkg_version_reference. - * For example, if the pkg_version_reference is ">10.3.0 < 10.4.0" and 10.3.1 - * is installed, then: - * * if 10.3.2 is available, latest_matching_version should be 10.3.2, but - * * if 10.4 is available while >10.3.1 is not, this should remain empty. - */ - latestMatchingVersion?: PackageAppVersion; - /** - * LatestVersion - * - * The latest version available for this package, regardless of the pkg_version_reference. - */ - latestVersion?: PackageAppVersion; - /** - * Custom data added by the plugin - * - * A plugin can define custom details for data which is not yet, or never will - * be specified in the core.packaging.CreateInstalledPackageRequest fields. The use - * of an `Any` field means that each plugin can define the structure of this - * message as required, while still satisfying the core interface. - * See https://developers.google.com/protocol-buffers/docs/proto3#any - */ - customDetail?: Any; -} - -/** - * Context - * - * A Context specifies the context of the message - */ -export interface Context { - /** - * Cluster - * - * A cluster name can be provided to target a specific cluster if multiple - * clusters are configured, otherwise all clusters will be assumed. - */ - cluster: string; - /** - * Namespace - * - * A namespace must be provided if the context of the operation is for a resource - * or resources in a particular namespace. - * For requests to list items, not including a namespace here implies that the context - * for the request is everything the requesting user can read, though the result can - * be filtered by any filtering options of the request. Plugins may choose to return - * Unimplemented for some queries for which we do not yet have a need. - */ - namespace: string; -} - -/** - * AvailablePackageReference - * - * An AvailablePackageReference has the minimum information required to uniquely - * identify an available package. This is re-used on the summary and details of an - * available package. - */ -export interface AvailablePackageReference { - /** - * Available package context - * - * The context (cluster/namespace) for the package. - */ - context?: Context; - /** - * Available package identifier - * - * The fully qualified identifier for the available package - * (ie. a unique name for the context). For some packaging systems - * (particularly those where an available package is backed by a CR) this - * will just be the name, but for others such as those where an available - * package is not backed by a CR (eg. standard helm) it may be necessary - * to include the repository in the name or even the repo namespace - * to ensure this is unique. - * For example two helm repositories can define - * an "apache" chart that is available globally, the names would need to - * encode that to be unique (ie. "repoA:apache" and "repoB:apache"). - */ - identifier: string; - /** - * Plugin for the available package - * - * The plugin used to interact with this available package. - * This field should be omitted when the request is in the context of a specific plugin. - */ - plugin?: Plugin; -} - -/** - * Maintainer - * - * Maintainers for the package. - */ -export interface Maintainer { - /** - * Maintainer name - * - * A maintainer name - */ - name: string; - /** - * Maintainer email - * - * A maintainer email - */ - email: string; -} - -/** - * FilterOptions - * - * FilterOptions available when requesting summaries - */ -export interface FilterOptions { - /** - * Text query - * - * Text query for the request - */ - query: string; - /** - * Categories - * - * Collection of categories for the request - */ - categories: string[]; - /** - * Repositories - * - * Collection of repositories where the packages belong to - */ - repositories: string[]; - /** - * Package version - * - * Package version for the request - */ - pkgVersion: string; - /** - * App version - * - * Packaged app version for the request - */ - appVersion: string; -} - -/** - * PaginationOptions - * - * The PaginationOptions based on the example proto at: - * https://cloud.google.com/apis/design/design_patterns#list_pagination - * just encapsulated in a message so it can be reused on different request messages. - */ -export interface PaginationOptions { - /** - * Page token - * - * The client uses this field to request a specific page of the list results. - */ - pageToken: string; - /** - * Page size - * - * Clients use this field to specify the maximum number of results to be - * returned by the server. The server may further constrain the maximum number - * of results returned in a single page. If the page_size is 0, the server - * will decide the number of results to be returned. - */ - pageSize: number; -} - -/** - * InstalledPackageReference - * - * An InstalledPackageReference has the minimum information required to uniquely - * identify an installed package. - */ -export interface InstalledPackageReference { - /** - * Installed package context - * - * The context (cluster/namespace) for the package. - */ - context?: Context; - /** - * The fully qualified identifier for the installed package - * (ie. a unique name for the context). - */ - identifier: string; - /** - * The plugin used to identify and interact with the installed package. - * This field can be omitted when the request is in the context of a specific plugin. - */ - plugin?: Plugin; -} - -/** - * VersionReference - * - * A VersionReference defines a version or constraint limiting matching versions. - * The reason it is a separate message is so that in the future we can add other - * fields as necessary (such as something similar to Carvel's `prereleases` option - * to its versionSelection). - */ -export interface VersionReference { - /** - * Version - * - * The format of the version constraint depends on the backend. For example, - * for a flux v2 and Carvel it's a semver expression, such as ">=10.3 < 10.4" - */ - version: string; -} - -/** - * InstalledPackageStatus - * - * An InstalledPackageStatus reports on the current status of the installation. - */ -export interface InstalledPackageStatus { - /** - * Ready - * - * An indication of whether the installation is ready or not - */ - ready: boolean; - /** - * Reason - * - * An enum indicating the reason for the current status. - */ - reason: InstalledPackageStatus_StatusReason; - /** - * UserReason - * - * Optional text to return for user context, which may be plugin specific. - */ - userReason: string; -} - -/** - * StatusReason - * - * Generic reasons why an installed package may be ready or not. - * These should make sense across different packaging plugins. - */ -export enum InstalledPackageStatus_StatusReason { - STATUS_REASON_UNSPECIFIED = 0, - STATUS_REASON_INSTALLED = 1, - STATUS_REASON_UNINSTALLED = 2, - STATUS_REASON_FAILED = 3, - STATUS_REASON_PENDING = 4, - UNRECOGNIZED = -1, -} - -export function installedPackageStatus_StatusReasonFromJSON( - object: any, -): InstalledPackageStatus_StatusReason { - switch (object) { - case 0: - case "STATUS_REASON_UNSPECIFIED": - return InstalledPackageStatus_StatusReason.STATUS_REASON_UNSPECIFIED; - case 1: - case "STATUS_REASON_INSTALLED": - return InstalledPackageStatus_StatusReason.STATUS_REASON_INSTALLED; - case 2: - case "STATUS_REASON_UNINSTALLED": - return InstalledPackageStatus_StatusReason.STATUS_REASON_UNINSTALLED; - case 3: - case "STATUS_REASON_FAILED": - return InstalledPackageStatus_StatusReason.STATUS_REASON_FAILED; - case 4: - case "STATUS_REASON_PENDING": - return InstalledPackageStatus_StatusReason.STATUS_REASON_PENDING; - case -1: - case "UNRECOGNIZED": - default: - return InstalledPackageStatus_StatusReason.UNRECOGNIZED; - } -} - -export function installedPackageStatus_StatusReasonToJSON( - object: InstalledPackageStatus_StatusReason, -): string { - switch (object) { - case InstalledPackageStatus_StatusReason.STATUS_REASON_UNSPECIFIED: - return "STATUS_REASON_UNSPECIFIED"; - case InstalledPackageStatus_StatusReason.STATUS_REASON_INSTALLED: - return "STATUS_REASON_INSTALLED"; - case InstalledPackageStatus_StatusReason.STATUS_REASON_UNINSTALLED: - return "STATUS_REASON_UNINSTALLED"; - case InstalledPackageStatus_StatusReason.STATUS_REASON_FAILED: - return "STATUS_REASON_FAILED"; - case InstalledPackageStatus_StatusReason.STATUS_REASON_PENDING: - return "STATUS_REASON_PENDING"; - case InstalledPackageStatus_StatusReason.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** - * ReconciliationOptions - * - * ReconciliationOptions enable specifying standard fields for backends that continuously - * reconcile a package install as new matching versions are released. Most of the naming - * is from the flux HelmReleaseSpec though it maps directly to equivalent fields on Carvel's - * InstalledPackage. - */ -export interface ReconciliationOptions { - /** - * Reconciliation Interval - * - * The interval with which the package is checked for reconciliation (in time+unit) - */ - interval: string; - /** - * Suspend - * - * Whether reconciliation should be suspended until otherwise enabled. - * This can be utilized to e.g. temporarily ignore chart changes, and - * prevent a Helm release from getting upgraded - */ - suspend: boolean; - /** - * ServiceAccountName - * - * A name for a service account in the same namespace which should be used - * to perform the reconciliation. - */ - serviceAccountName: string; -} - -/** - * Package AppVersion - * - * PackageAppVersion conveys both the package version and the packaged app version. - */ -export interface PackageAppVersion { - /** - * Package version - * - * Version of the package itself - */ - pkgVersion: string; - /** - * Application version - * - * Version of the packaged application - */ - appVersion: string; -} - -/** - * Resource reference - * - * A reference to a Kubernetes resource related to a specific installed package. - * The context (cluster) for each resource is that of the related - * installed package. - */ -export interface ResourceRef { - /** - * The APIVersion directly from the resource has the group and version, eg. "apps/v1" - * or just the version for core resources. - */ - apiVersion: string; - /** - * The Kind directly from the templated manifest. Together with the APIVersion this - * forms the GroupVersionKind. - */ - kind: string; - /** The name of the specific resource in the context of the installed package. */ - name: string; - /** - * The namespace of the specific resource in the context of the installed - * package. In most cases this will be identical to the namespace of the - * installed package. Exceptions will be non-namespaced resources and packages - * that install resources in other namespaces for special reasons. - */ - namespace: string; -} - -function createBaseGetAvailablePackageSummariesRequest(): GetAvailablePackageSummariesRequest { - return { context: undefined, filterOptions: undefined, paginationOptions: undefined }; -} - -export const GetAvailablePackageSummariesRequest = { - encode( - message: GetAvailablePackageSummariesRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.filterOptions !== undefined) { - FilterOptions.encode(message.filterOptions, writer.uint32(18).fork()).ldelim(); - } - if (message.paginationOptions !== undefined) { - PaginationOptions.encode(message.paginationOptions, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAvailablePackageSummariesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAvailablePackageSummariesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.filterOptions = FilterOptions.decode(reader, reader.uint32()); - break; - case 3: - message.paginationOptions = PaginationOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetAvailablePackageSummariesRequest { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - filterOptions: isSet(object.filterOptions) - ? FilterOptions.fromJSON(object.filterOptions) - : undefined, - paginationOptions: isSet(object.paginationOptions) - ? PaginationOptions.fromJSON(object.paginationOptions) - : undefined, - }; - }, - - toJSON(message: GetAvailablePackageSummariesRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.filterOptions !== undefined && - (obj.filterOptions = message.filterOptions - ? FilterOptions.toJSON(message.filterOptions) - : undefined); - message.paginationOptions !== undefined && - (obj.paginationOptions = message.paginationOptions - ? PaginationOptions.toJSON(message.paginationOptions) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetAvailablePackageSummariesRequest { - return GetAvailablePackageSummariesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetAvailablePackageSummariesRequest { - const message = createBaseGetAvailablePackageSummariesRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.filterOptions = - object.filterOptions !== undefined && object.filterOptions !== null - ? FilterOptions.fromPartial(object.filterOptions) - : undefined; - message.paginationOptions = - object.paginationOptions !== undefined && object.paginationOptions !== null - ? PaginationOptions.fromPartial(object.paginationOptions) - : undefined; - return message; - }, -}; - -function createBaseGetAvailablePackageDetailRequest(): GetAvailablePackageDetailRequest { - return { availablePackageRef: undefined, pkgVersion: "" }; -} - -export const GetAvailablePackageDetailRequest = { - encode( - message: GetAvailablePackageDetailRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.availablePackageRef !== undefined) { - AvailablePackageReference.encode( - message.availablePackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.pkgVersion !== "") { - writer.uint32(18).string(message.pkgVersion); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAvailablePackageDetailRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAvailablePackageDetailRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageRef = AvailablePackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.pkgVersion = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetAvailablePackageDetailRequest { - return { - availablePackageRef: isSet(object.availablePackageRef) - ? AvailablePackageReference.fromJSON(object.availablePackageRef) - : undefined, - pkgVersion: isSet(object.pkgVersion) ? String(object.pkgVersion) : "", - }; - }, - - toJSON(message: GetAvailablePackageDetailRequest): unknown { - const obj: any = {}; - message.availablePackageRef !== undefined && - (obj.availablePackageRef = message.availablePackageRef - ? AvailablePackageReference.toJSON(message.availablePackageRef) - : undefined); - message.pkgVersion !== undefined && (obj.pkgVersion = message.pkgVersion); - return obj; - }, - - create, I>>( - base?: I, - ): GetAvailablePackageDetailRequest { - return GetAvailablePackageDetailRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetAvailablePackageDetailRequest { - const message = createBaseGetAvailablePackageDetailRequest(); - message.availablePackageRef = - object.availablePackageRef !== undefined && object.availablePackageRef !== null - ? AvailablePackageReference.fromPartial(object.availablePackageRef) - : undefined; - message.pkgVersion = object.pkgVersion ?? ""; - return message; - }, -}; - -function createBaseGetAvailablePackageVersionsRequest(): GetAvailablePackageVersionsRequest { - return { availablePackageRef: undefined, pkgVersion: "" }; -} - -export const GetAvailablePackageVersionsRequest = { - encode( - message: GetAvailablePackageVersionsRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.availablePackageRef !== undefined) { - AvailablePackageReference.encode( - message.availablePackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.pkgVersion !== "") { - writer.uint32(18).string(message.pkgVersion); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAvailablePackageVersionsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAvailablePackageVersionsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageRef = AvailablePackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.pkgVersion = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetAvailablePackageVersionsRequest { - return { - availablePackageRef: isSet(object.availablePackageRef) - ? AvailablePackageReference.fromJSON(object.availablePackageRef) - : undefined, - pkgVersion: isSet(object.pkgVersion) ? String(object.pkgVersion) : "", - }; - }, - - toJSON(message: GetAvailablePackageVersionsRequest): unknown { - const obj: any = {}; - message.availablePackageRef !== undefined && - (obj.availablePackageRef = message.availablePackageRef - ? AvailablePackageReference.toJSON(message.availablePackageRef) - : undefined); - message.pkgVersion !== undefined && (obj.pkgVersion = message.pkgVersion); - return obj; - }, - - create, I>>( - base?: I, - ): GetAvailablePackageVersionsRequest { - return GetAvailablePackageVersionsRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetAvailablePackageVersionsRequest { - const message = createBaseGetAvailablePackageVersionsRequest(); - message.availablePackageRef = - object.availablePackageRef !== undefined && object.availablePackageRef !== null - ? AvailablePackageReference.fromPartial(object.availablePackageRef) - : undefined; - message.pkgVersion = object.pkgVersion ?? ""; - return message; - }, -}; - -function createBaseGetInstalledPackageSummariesRequest(): GetInstalledPackageSummariesRequest { - return { context: undefined, paginationOptions: undefined }; -} - -export const GetInstalledPackageSummariesRequest = { - encode( - message: GetInstalledPackageSummariesRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.paginationOptions !== undefined) { - PaginationOptions.encode(message.paginationOptions, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetInstalledPackageSummariesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstalledPackageSummariesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.paginationOptions = PaginationOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetInstalledPackageSummariesRequest { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - paginationOptions: isSet(object.paginationOptions) - ? PaginationOptions.fromJSON(object.paginationOptions) - : undefined, - }; - }, - - toJSON(message: GetInstalledPackageSummariesRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.paginationOptions !== undefined && - (obj.paginationOptions = message.paginationOptions - ? PaginationOptions.toJSON(message.paginationOptions) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetInstalledPackageSummariesRequest { - return GetInstalledPackageSummariesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetInstalledPackageSummariesRequest { - const message = createBaseGetInstalledPackageSummariesRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.paginationOptions = - object.paginationOptions !== undefined && object.paginationOptions !== null - ? PaginationOptions.fromPartial(object.paginationOptions) - : undefined; - return message; - }, -}; - -function createBaseGetInstalledPackageDetailRequest(): GetInstalledPackageDetailRequest { - return { installedPackageRef: undefined }; -} - -export const GetInstalledPackageDetailRequest = { - encode( - message: GetInstalledPackageDetailRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetInstalledPackageDetailRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstalledPackageDetailRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetInstalledPackageDetailRequest { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - }; - }, - - toJSON(message: GetInstalledPackageDetailRequest): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetInstalledPackageDetailRequest { - return GetInstalledPackageDetailRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetInstalledPackageDetailRequest { - const message = createBaseGetInstalledPackageDetailRequest(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - return message; - }, -}; - -function createBaseCreateInstalledPackageRequest(): CreateInstalledPackageRequest { - return { - availablePackageRef: undefined, - targetContext: undefined, - name: "", - pkgVersionReference: undefined, - values: "", - reconciliationOptions: undefined, - }; -} - -export const CreateInstalledPackageRequest = { - encode( - message: CreateInstalledPackageRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.availablePackageRef !== undefined) { - AvailablePackageReference.encode( - message.availablePackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.targetContext !== undefined) { - Context.encode(message.targetContext, writer.uint32(18).fork()).ldelim(); - } - if (message.name !== "") { - writer.uint32(26).string(message.name); - } - if (message.pkgVersionReference !== undefined) { - VersionReference.encode(message.pkgVersionReference, writer.uint32(34).fork()).ldelim(); - } - if (message.values !== "") { - writer.uint32(42).string(message.values); - } - if (message.reconciliationOptions !== undefined) { - ReconciliationOptions.encode( - message.reconciliationOptions, - writer.uint32(50).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateInstalledPackageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateInstalledPackageRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageRef = AvailablePackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.targetContext = Context.decode(reader, reader.uint32()); - break; - case 3: - message.name = reader.string(); - break; - case 4: - message.pkgVersionReference = VersionReference.decode(reader, reader.uint32()); - break; - case 5: - message.values = reader.string(); - break; - case 6: - message.reconciliationOptions = ReconciliationOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CreateInstalledPackageRequest { - return { - availablePackageRef: isSet(object.availablePackageRef) - ? AvailablePackageReference.fromJSON(object.availablePackageRef) - : undefined, - targetContext: isSet(object.targetContext) - ? Context.fromJSON(object.targetContext) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - pkgVersionReference: isSet(object.pkgVersionReference) - ? VersionReference.fromJSON(object.pkgVersionReference) - : undefined, - values: isSet(object.values) ? String(object.values) : "", - reconciliationOptions: isSet(object.reconciliationOptions) - ? ReconciliationOptions.fromJSON(object.reconciliationOptions) - : undefined, - }; - }, - - toJSON(message: CreateInstalledPackageRequest): unknown { - const obj: any = {}; - message.availablePackageRef !== undefined && - (obj.availablePackageRef = message.availablePackageRef - ? AvailablePackageReference.toJSON(message.availablePackageRef) - : undefined); - message.targetContext !== undefined && - (obj.targetContext = message.targetContext - ? Context.toJSON(message.targetContext) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.pkgVersionReference !== undefined && - (obj.pkgVersionReference = message.pkgVersionReference - ? VersionReference.toJSON(message.pkgVersionReference) - : undefined); - message.values !== undefined && (obj.values = message.values); - message.reconciliationOptions !== undefined && - (obj.reconciliationOptions = message.reconciliationOptions - ? ReconciliationOptions.toJSON(message.reconciliationOptions) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): CreateInstalledPackageRequest { - return CreateInstalledPackageRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CreateInstalledPackageRequest { - const message = createBaseCreateInstalledPackageRequest(); - message.availablePackageRef = - object.availablePackageRef !== undefined && object.availablePackageRef !== null - ? AvailablePackageReference.fromPartial(object.availablePackageRef) - : undefined; - message.targetContext = - object.targetContext !== undefined && object.targetContext !== null - ? Context.fromPartial(object.targetContext) - : undefined; - message.name = object.name ?? ""; - message.pkgVersionReference = - object.pkgVersionReference !== undefined && object.pkgVersionReference !== null - ? VersionReference.fromPartial(object.pkgVersionReference) - : undefined; - message.values = object.values ?? ""; - message.reconciliationOptions = - object.reconciliationOptions !== undefined && object.reconciliationOptions !== null - ? ReconciliationOptions.fromPartial(object.reconciliationOptions) - : undefined; - return message; - }, -}; - -function createBaseUpdateInstalledPackageRequest(): UpdateInstalledPackageRequest { - return { - installedPackageRef: undefined, - pkgVersionReference: undefined, - values: "", - reconciliationOptions: undefined, - }; -} - -export const UpdateInstalledPackageRequest = { - encode( - message: UpdateInstalledPackageRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.pkgVersionReference !== undefined) { - VersionReference.encode(message.pkgVersionReference, writer.uint32(18).fork()).ldelim(); - } - if (message.values !== "") { - writer.uint32(26).string(message.values); - } - if (message.reconciliationOptions !== undefined) { - ReconciliationOptions.encode( - message.reconciliationOptions, - writer.uint32(34).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UpdateInstalledPackageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateInstalledPackageRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.pkgVersionReference = VersionReference.decode(reader, reader.uint32()); - break; - case 3: - message.values = reader.string(); - break; - case 4: - message.reconciliationOptions = ReconciliationOptions.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): UpdateInstalledPackageRequest { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - pkgVersionReference: isSet(object.pkgVersionReference) - ? VersionReference.fromJSON(object.pkgVersionReference) - : undefined, - values: isSet(object.values) ? String(object.values) : "", - reconciliationOptions: isSet(object.reconciliationOptions) - ? ReconciliationOptions.fromJSON(object.reconciliationOptions) - : undefined, - }; - }, - - toJSON(message: UpdateInstalledPackageRequest): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - message.pkgVersionReference !== undefined && - (obj.pkgVersionReference = message.pkgVersionReference - ? VersionReference.toJSON(message.pkgVersionReference) - : undefined); - message.values !== undefined && (obj.values = message.values); - message.reconciliationOptions !== undefined && - (obj.reconciliationOptions = message.reconciliationOptions - ? ReconciliationOptions.toJSON(message.reconciliationOptions) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): UpdateInstalledPackageRequest { - return UpdateInstalledPackageRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): UpdateInstalledPackageRequest { - const message = createBaseUpdateInstalledPackageRequest(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - message.pkgVersionReference = - object.pkgVersionReference !== undefined && object.pkgVersionReference !== null - ? VersionReference.fromPartial(object.pkgVersionReference) - : undefined; - message.values = object.values ?? ""; - message.reconciliationOptions = - object.reconciliationOptions !== undefined && object.reconciliationOptions !== null - ? ReconciliationOptions.fromPartial(object.reconciliationOptions) - : undefined; - return message; - }, -}; - -function createBaseDeleteInstalledPackageRequest(): DeleteInstalledPackageRequest { - return { installedPackageRef: undefined }; -} - -export const DeleteInstalledPackageRequest = { - encode( - message: DeleteInstalledPackageRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DeleteInstalledPackageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteInstalledPackageRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): DeleteInstalledPackageRequest { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - }; - }, - - toJSON(message: DeleteInstalledPackageRequest): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): DeleteInstalledPackageRequest { - return DeleteInstalledPackageRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): DeleteInstalledPackageRequest { - const message = createBaseDeleteInstalledPackageRequest(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - return message; - }, -}; - -function createBaseGetInstalledPackageResourceRefsRequest(): GetInstalledPackageResourceRefsRequest { - return { installedPackageRef: undefined }; -} - -export const GetInstalledPackageResourceRefsRequest = { - encode( - message: GetInstalledPackageResourceRefsRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetInstalledPackageResourceRefsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstalledPackageResourceRefsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetInstalledPackageResourceRefsRequest { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - }; - }, - - toJSON(message: GetInstalledPackageResourceRefsRequest): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetInstalledPackageResourceRefsRequest { - return GetInstalledPackageResourceRefsRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetInstalledPackageResourceRefsRequest { - const message = createBaseGetInstalledPackageResourceRefsRequest(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - return message; - }, -}; - -function createBaseGetAvailablePackageSummariesResponse(): GetAvailablePackageSummariesResponse { - return { availablePackageSummaries: [], nextPageToken: "", categories: [] }; -} - -export const GetAvailablePackageSummariesResponse = { - encode( - message: GetAvailablePackageSummariesResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.availablePackageSummaries) { - AvailablePackageSummary.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - for (const v of message.categories) { - writer.uint32(26).string(v!); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAvailablePackageSummariesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAvailablePackageSummariesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageSummaries.push( - AvailablePackageSummary.decode(reader, reader.uint32()), - ); - break; - case 2: - message.nextPageToken = reader.string(); - break; - case 3: - message.categories.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetAvailablePackageSummariesResponse { - return { - availablePackageSummaries: Array.isArray(object?.availablePackageSummaries) - ? object.availablePackageSummaries.map((e: any) => AvailablePackageSummary.fromJSON(e)) - : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "", - categories: Array.isArray(object?.categories) - ? object.categories.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: GetAvailablePackageSummariesResponse): unknown { - const obj: any = {}; - if (message.availablePackageSummaries) { - obj.availablePackageSummaries = message.availablePackageSummaries.map(e => - e ? AvailablePackageSummary.toJSON(e) : undefined, - ); - } else { - obj.availablePackageSummaries = []; - } - message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken); - if (message.categories) { - obj.categories = message.categories.map(e => e); - } else { - obj.categories = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetAvailablePackageSummariesResponse { - return GetAvailablePackageSummariesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetAvailablePackageSummariesResponse { - const message = createBaseGetAvailablePackageSummariesResponse(); - message.availablePackageSummaries = - object.availablePackageSummaries?.map(e => AvailablePackageSummary.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - message.categories = object.categories?.map(e => e) || []; - return message; - }, -}; - -function createBaseGetAvailablePackageDetailResponse(): GetAvailablePackageDetailResponse { - return { availablePackageDetail: undefined }; -} - -export const GetAvailablePackageDetailResponse = { - encode( - message: GetAvailablePackageDetailResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.availablePackageDetail !== undefined) { - AvailablePackageDetail.encode( - message.availablePackageDetail, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAvailablePackageDetailResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAvailablePackageDetailResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageDetail = AvailablePackageDetail.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetAvailablePackageDetailResponse { - return { - availablePackageDetail: isSet(object.availablePackageDetail) - ? AvailablePackageDetail.fromJSON(object.availablePackageDetail) - : undefined, - }; - }, - - toJSON(message: GetAvailablePackageDetailResponse): unknown { - const obj: any = {}; - message.availablePackageDetail !== undefined && - (obj.availablePackageDetail = message.availablePackageDetail - ? AvailablePackageDetail.toJSON(message.availablePackageDetail) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetAvailablePackageDetailResponse { - return GetAvailablePackageDetailResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetAvailablePackageDetailResponse { - const message = createBaseGetAvailablePackageDetailResponse(); - message.availablePackageDetail = - object.availablePackageDetail !== undefined && object.availablePackageDetail !== null - ? AvailablePackageDetail.fromPartial(object.availablePackageDetail) - : undefined; - return message; - }, -}; - -function createBaseGetAvailablePackageVersionsResponse(): GetAvailablePackageVersionsResponse { - return { packageAppVersions: [] }; -} - -export const GetAvailablePackageVersionsResponse = { - encode( - message: GetAvailablePackageVersionsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.packageAppVersions) { - PackageAppVersion.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetAvailablePackageVersionsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetAvailablePackageVersionsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageAppVersions.push(PackageAppVersion.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetAvailablePackageVersionsResponse { - return { - packageAppVersions: Array.isArray(object?.packageAppVersions) - ? object.packageAppVersions.map((e: any) => PackageAppVersion.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetAvailablePackageVersionsResponse): unknown { - const obj: any = {}; - if (message.packageAppVersions) { - obj.packageAppVersions = message.packageAppVersions.map(e => - e ? PackageAppVersion.toJSON(e) : undefined, - ); - } else { - obj.packageAppVersions = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetAvailablePackageVersionsResponse { - return GetAvailablePackageVersionsResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetAvailablePackageVersionsResponse { - const message = createBaseGetAvailablePackageVersionsResponse(); - message.packageAppVersions = - object.packageAppVersions?.map(e => PackageAppVersion.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGetInstalledPackageSummariesResponse(): GetInstalledPackageSummariesResponse { - return { installedPackageSummaries: [], nextPageToken: "" }; -} - -export const GetInstalledPackageSummariesResponse = { - encode( - message: GetInstalledPackageSummariesResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.installedPackageSummaries) { - InstalledPackageSummary.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.nextPageToken !== "") { - writer.uint32(18).string(message.nextPageToken); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetInstalledPackageSummariesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstalledPackageSummariesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageSummaries.push( - InstalledPackageSummary.decode(reader, reader.uint32()), - ); - break; - case 2: - message.nextPageToken = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetInstalledPackageSummariesResponse { - return { - installedPackageSummaries: Array.isArray(object?.installedPackageSummaries) - ? object.installedPackageSummaries.map((e: any) => InstalledPackageSummary.fromJSON(e)) - : [], - nextPageToken: isSet(object.nextPageToken) ? String(object.nextPageToken) : "", - }; - }, - - toJSON(message: GetInstalledPackageSummariesResponse): unknown { - const obj: any = {}; - if (message.installedPackageSummaries) { - obj.installedPackageSummaries = message.installedPackageSummaries.map(e => - e ? InstalledPackageSummary.toJSON(e) : undefined, - ); - } else { - obj.installedPackageSummaries = []; - } - message.nextPageToken !== undefined && (obj.nextPageToken = message.nextPageToken); - return obj; - }, - - create, I>>( - base?: I, - ): GetInstalledPackageSummariesResponse { - return GetInstalledPackageSummariesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetInstalledPackageSummariesResponse { - const message = createBaseGetInstalledPackageSummariesResponse(); - message.installedPackageSummaries = - object.installedPackageSummaries?.map(e => InstalledPackageSummary.fromPartial(e)) || []; - message.nextPageToken = object.nextPageToken ?? ""; - return message; - }, -}; - -function createBaseGetInstalledPackageDetailResponse(): GetInstalledPackageDetailResponse { - return { installedPackageDetail: undefined }; -} - -export const GetInstalledPackageDetailResponse = { - encode( - message: GetInstalledPackageDetailResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageDetail !== undefined) { - InstalledPackageDetail.encode( - message.installedPackageDetail, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetInstalledPackageDetailResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstalledPackageDetailResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageDetail = InstalledPackageDetail.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetInstalledPackageDetailResponse { - return { - installedPackageDetail: isSet(object.installedPackageDetail) - ? InstalledPackageDetail.fromJSON(object.installedPackageDetail) - : undefined, - }; - }, - - toJSON(message: GetInstalledPackageDetailResponse): unknown { - const obj: any = {}; - message.installedPackageDetail !== undefined && - (obj.installedPackageDetail = message.installedPackageDetail - ? InstalledPackageDetail.toJSON(message.installedPackageDetail) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetInstalledPackageDetailResponse { - return GetInstalledPackageDetailResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetInstalledPackageDetailResponse { - const message = createBaseGetInstalledPackageDetailResponse(); - message.installedPackageDetail = - object.installedPackageDetail !== undefined && object.installedPackageDetail !== null - ? InstalledPackageDetail.fromPartial(object.installedPackageDetail) - : undefined; - return message; - }, -}; - -function createBaseCreateInstalledPackageResponse(): CreateInstalledPackageResponse { - return { installedPackageRef: undefined }; -} - -export const CreateInstalledPackageResponse = { - encode( - message: CreateInstalledPackageResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateInstalledPackageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateInstalledPackageResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CreateInstalledPackageResponse { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - }; - }, - - toJSON(message: CreateInstalledPackageResponse): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): CreateInstalledPackageResponse { - return CreateInstalledPackageResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CreateInstalledPackageResponse { - const message = createBaseCreateInstalledPackageResponse(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - return message; - }, -}; - -function createBaseUpdateInstalledPackageResponse(): UpdateInstalledPackageResponse { - return { installedPackageRef: undefined }; -} - -export const UpdateInstalledPackageResponse = { - encode( - message: UpdateInstalledPackageResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UpdateInstalledPackageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdateInstalledPackageResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): UpdateInstalledPackageResponse { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - }; - }, - - toJSON(message: UpdateInstalledPackageResponse): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): UpdateInstalledPackageResponse { - return UpdateInstalledPackageResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): UpdateInstalledPackageResponse { - const message = createBaseUpdateInstalledPackageResponse(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - return message; - }, -}; - -function createBaseDeleteInstalledPackageResponse(): DeleteInstalledPackageResponse { - return {}; -} - -export const DeleteInstalledPackageResponse = { - encode(_: DeleteInstalledPackageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DeleteInstalledPackageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeleteInstalledPackageResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): DeleteInstalledPackageResponse { - return {}; - }, - - toJSON(_: DeleteInstalledPackageResponse): unknown { - const obj: any = {}; - return obj; - }, - - create, I>>( - base?: I, - ): DeleteInstalledPackageResponse { - return DeleteInstalledPackageResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - _: I, - ): DeleteInstalledPackageResponse { - const message = createBaseDeleteInstalledPackageResponse(); - return message; - }, -}; - -function createBaseGetInstalledPackageResourceRefsResponse(): GetInstalledPackageResourceRefsResponse { - return { context: undefined, resourceRefs: [] }; -} - -export const GetInstalledPackageResourceRefsResponse = { - encode( - message: GetInstalledPackageResourceRefsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.resourceRefs) { - ResourceRef.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetInstalledPackageResourceRefsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetInstalledPackageResourceRefsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.resourceRefs.push(ResourceRef.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetInstalledPackageResourceRefsResponse { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - resourceRefs: Array.isArray(object?.resourceRefs) - ? object.resourceRefs.map((e: any) => ResourceRef.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetInstalledPackageResourceRefsResponse): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - if (message.resourceRefs) { - obj.resourceRefs = message.resourceRefs.map(e => (e ? ResourceRef.toJSON(e) : undefined)); - } else { - obj.resourceRefs = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetInstalledPackageResourceRefsResponse { - return GetInstalledPackageResourceRefsResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetInstalledPackageResourceRefsResponse { - const message = createBaseGetInstalledPackageResourceRefsResponse(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.resourceRefs = object.resourceRefs?.map(e => ResourceRef.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseAvailablePackageSummary(): AvailablePackageSummary { - return { - availablePackageRef: undefined, - name: "", - latestVersion: undefined, - iconUrl: "", - displayName: "", - shortDescription: "", - categories: [], - }; -} - -export const AvailablePackageSummary = { - encode(message: AvailablePackageSummary, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.availablePackageRef !== undefined) { - AvailablePackageReference.encode( - message.availablePackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - if (message.latestVersion !== undefined) { - PackageAppVersion.encode(message.latestVersion, writer.uint32(26).fork()).ldelim(); - } - if (message.iconUrl !== "") { - writer.uint32(34).string(message.iconUrl); - } - if (message.displayName !== "") { - writer.uint32(42).string(message.displayName); - } - if (message.shortDescription !== "") { - writer.uint32(50).string(message.shortDescription); - } - for (const v of message.categories) { - writer.uint32(58).string(v!); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AvailablePackageSummary { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAvailablePackageSummary(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageRef = AvailablePackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.latestVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 4: - message.iconUrl = reader.string(); - break; - case 5: - message.displayName = reader.string(); - break; - case 6: - message.shortDescription = reader.string(); - break; - case 7: - message.categories.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): AvailablePackageSummary { - return { - availablePackageRef: isSet(object.availablePackageRef) - ? AvailablePackageReference.fromJSON(object.availablePackageRef) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - latestVersion: isSet(object.latestVersion) - ? PackageAppVersion.fromJSON(object.latestVersion) - : undefined, - iconUrl: isSet(object.iconUrl) ? String(object.iconUrl) : "", - displayName: isSet(object.displayName) ? String(object.displayName) : "", - shortDescription: isSet(object.shortDescription) ? String(object.shortDescription) : "", - categories: Array.isArray(object?.categories) - ? object.categories.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: AvailablePackageSummary): unknown { - const obj: any = {}; - message.availablePackageRef !== undefined && - (obj.availablePackageRef = message.availablePackageRef - ? AvailablePackageReference.toJSON(message.availablePackageRef) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.latestVersion !== undefined && - (obj.latestVersion = message.latestVersion - ? PackageAppVersion.toJSON(message.latestVersion) - : undefined); - message.iconUrl !== undefined && (obj.iconUrl = message.iconUrl); - message.displayName !== undefined && (obj.displayName = message.displayName); - message.shortDescription !== undefined && (obj.shortDescription = message.shortDescription); - if (message.categories) { - obj.categories = message.categories.map(e => e); - } else { - obj.categories = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): AvailablePackageSummary { - return AvailablePackageSummary.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): AvailablePackageSummary { - const message = createBaseAvailablePackageSummary(); - message.availablePackageRef = - object.availablePackageRef !== undefined && object.availablePackageRef !== null - ? AvailablePackageReference.fromPartial(object.availablePackageRef) - : undefined; - message.name = object.name ?? ""; - message.latestVersion = - object.latestVersion !== undefined && object.latestVersion !== null - ? PackageAppVersion.fromPartial(object.latestVersion) - : undefined; - message.iconUrl = object.iconUrl ?? ""; - message.displayName = object.displayName ?? ""; - message.shortDescription = object.shortDescription ?? ""; - message.categories = object.categories?.map(e => e) || []; - return message; - }, -}; - -function createBaseAvailablePackageDetail(): AvailablePackageDetail { - return { - availablePackageRef: undefined, - name: "", - version: undefined, - repoUrl: "", - homeUrl: "", - iconUrl: "", - displayName: "", - shortDescription: "", - longDescription: "", - readme: "", - defaultValues: "", - additionalDefaultValues: {}, - valuesSchema: "", - sourceUrls: [], - maintainers: [], - categories: [], - customDetail: undefined, - }; -} - -export const AvailablePackageDetail = { - encode(message: AvailablePackageDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.availablePackageRef !== undefined) { - AvailablePackageReference.encode( - message.availablePackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - if (message.version !== undefined) { - PackageAppVersion.encode(message.version, writer.uint32(26).fork()).ldelim(); - } - if (message.repoUrl !== "") { - writer.uint32(34).string(message.repoUrl); - } - if (message.homeUrl !== "") { - writer.uint32(42).string(message.homeUrl); - } - if (message.iconUrl !== "") { - writer.uint32(50).string(message.iconUrl); - } - if (message.displayName !== "") { - writer.uint32(58).string(message.displayName); - } - if (message.shortDescription !== "") { - writer.uint32(66).string(message.shortDescription); - } - if (message.longDescription !== "") { - writer.uint32(74).string(message.longDescription); - } - if (message.readme !== "") { - writer.uint32(82).string(message.readme); - } - if (message.defaultValues !== "") { - writer.uint32(90).string(message.defaultValues); - } - Object.entries(message.additionalDefaultValues).forEach(([key, value]) => { - AvailablePackageDetail_AdditionalDefaultValuesEntry.encode( - { key: key as any, value }, - writer.uint32(138).fork(), - ).ldelim(); - }); - if (message.valuesSchema !== "") { - writer.uint32(98).string(message.valuesSchema); - } - for (const v of message.sourceUrls) { - writer.uint32(106).string(v!); - } - for (const v of message.maintainers) { - Maintainer.encode(v!, writer.uint32(114).fork()).ldelim(); - } - for (const v of message.categories) { - writer.uint32(122).string(v!); - } - if (message.customDetail !== undefined) { - Any.encode(message.customDetail, writer.uint32(130).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AvailablePackageDetail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAvailablePackageDetail(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.availablePackageRef = AvailablePackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.version = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 4: - message.repoUrl = reader.string(); - break; - case 5: - message.homeUrl = reader.string(); - break; - case 6: - message.iconUrl = reader.string(); - break; - case 7: - message.displayName = reader.string(); - break; - case 8: - message.shortDescription = reader.string(); - break; - case 9: - message.longDescription = reader.string(); - break; - case 10: - message.readme = reader.string(); - break; - case 11: - message.defaultValues = reader.string(); - break; - case 17: - const entry17 = AvailablePackageDetail_AdditionalDefaultValuesEntry.decode( - reader, - reader.uint32(), - ); - if (entry17.value !== undefined) { - message.additionalDefaultValues[entry17.key] = entry17.value; - } - break; - case 12: - message.valuesSchema = reader.string(); - break; - case 13: - message.sourceUrls.push(reader.string()); - break; - case 14: - message.maintainers.push(Maintainer.decode(reader, reader.uint32())); - break; - case 15: - message.categories.push(reader.string()); - break; - case 16: - message.customDetail = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): AvailablePackageDetail { - return { - availablePackageRef: isSet(object.availablePackageRef) - ? AvailablePackageReference.fromJSON(object.availablePackageRef) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - version: isSet(object.version) ? PackageAppVersion.fromJSON(object.version) : undefined, - repoUrl: isSet(object.repoUrl) ? String(object.repoUrl) : "", - homeUrl: isSet(object.homeUrl) ? String(object.homeUrl) : "", - iconUrl: isSet(object.iconUrl) ? String(object.iconUrl) : "", - displayName: isSet(object.displayName) ? String(object.displayName) : "", - shortDescription: isSet(object.shortDescription) ? String(object.shortDescription) : "", - longDescription: isSet(object.longDescription) ? String(object.longDescription) : "", - readme: isSet(object.readme) ? String(object.readme) : "", - defaultValues: isSet(object.defaultValues) ? String(object.defaultValues) : "", - additionalDefaultValues: isObject(object.additionalDefaultValues) - ? Object.entries(object.additionalDefaultValues).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, - {}, - ) - : {}, - valuesSchema: isSet(object.valuesSchema) ? String(object.valuesSchema) : "", - sourceUrls: Array.isArray(object?.sourceUrls) - ? object.sourceUrls.map((e: any) => String(e)) - : [], - maintainers: Array.isArray(object?.maintainers) - ? object.maintainers.map((e: any) => Maintainer.fromJSON(e)) - : [], - categories: Array.isArray(object?.categories) - ? object.categories.map((e: any) => String(e)) - : [], - customDetail: isSet(object.customDetail) ? Any.fromJSON(object.customDetail) : undefined, - }; - }, - - toJSON(message: AvailablePackageDetail): unknown { - const obj: any = {}; - message.availablePackageRef !== undefined && - (obj.availablePackageRef = message.availablePackageRef - ? AvailablePackageReference.toJSON(message.availablePackageRef) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.version !== undefined && - (obj.version = message.version ? PackageAppVersion.toJSON(message.version) : undefined); - message.repoUrl !== undefined && (obj.repoUrl = message.repoUrl); - message.homeUrl !== undefined && (obj.homeUrl = message.homeUrl); - message.iconUrl !== undefined && (obj.iconUrl = message.iconUrl); - message.displayName !== undefined && (obj.displayName = message.displayName); - message.shortDescription !== undefined && (obj.shortDescription = message.shortDescription); - message.longDescription !== undefined && (obj.longDescription = message.longDescription); - message.readme !== undefined && (obj.readme = message.readme); - message.defaultValues !== undefined && (obj.defaultValues = message.defaultValues); - obj.additionalDefaultValues = {}; - if (message.additionalDefaultValues) { - Object.entries(message.additionalDefaultValues).forEach(([k, v]) => { - obj.additionalDefaultValues[k] = v; - }); - } - message.valuesSchema !== undefined && (obj.valuesSchema = message.valuesSchema); - if (message.sourceUrls) { - obj.sourceUrls = message.sourceUrls.map(e => e); - } else { - obj.sourceUrls = []; - } - if (message.maintainers) { - obj.maintainers = message.maintainers.map(e => (e ? Maintainer.toJSON(e) : undefined)); - } else { - obj.maintainers = []; - } - if (message.categories) { - obj.categories = message.categories.map(e => e); - } else { - obj.categories = []; - } - message.customDetail !== undefined && - (obj.customDetail = message.customDetail ? Any.toJSON(message.customDetail) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): AvailablePackageDetail { - return AvailablePackageDetail.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): AvailablePackageDetail { - const message = createBaseAvailablePackageDetail(); - message.availablePackageRef = - object.availablePackageRef !== undefined && object.availablePackageRef !== null - ? AvailablePackageReference.fromPartial(object.availablePackageRef) - : undefined; - message.name = object.name ?? ""; - message.version = - object.version !== undefined && object.version !== null - ? PackageAppVersion.fromPartial(object.version) - : undefined; - message.repoUrl = object.repoUrl ?? ""; - message.homeUrl = object.homeUrl ?? ""; - message.iconUrl = object.iconUrl ?? ""; - message.displayName = object.displayName ?? ""; - message.shortDescription = object.shortDescription ?? ""; - message.longDescription = object.longDescription ?? ""; - message.readme = object.readme ?? ""; - message.defaultValues = object.defaultValues ?? ""; - message.additionalDefaultValues = Object.entries(object.additionalDefaultValues ?? {}).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, {}); - message.valuesSchema = object.valuesSchema ?? ""; - message.sourceUrls = object.sourceUrls?.map(e => e) || []; - message.maintainers = object.maintainers?.map(e => Maintainer.fromPartial(e)) || []; - message.categories = object.categories?.map(e => e) || []; - message.customDetail = - object.customDetail !== undefined && object.customDetail !== null - ? Any.fromPartial(object.customDetail) - : undefined; - return message; - }, -}; - -function createBaseAvailablePackageDetail_AdditionalDefaultValuesEntry(): AvailablePackageDetail_AdditionalDefaultValuesEntry { - return { key: "", value: "" }; -} - -export const AvailablePackageDetail_AdditionalDefaultValuesEntry = { - encode( - message: AvailablePackageDetail_AdditionalDefaultValuesEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): AvailablePackageDetail_AdditionalDefaultValuesEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAvailablePackageDetail_AdditionalDefaultValuesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): AvailablePackageDetail_AdditionalDefaultValuesEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: AvailablePackageDetail_AdditionalDefaultValuesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): AvailablePackageDetail_AdditionalDefaultValuesEntry { - return AvailablePackageDetail_AdditionalDefaultValuesEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): AvailablePackageDetail_AdditionalDefaultValuesEntry { - const message = createBaseAvailablePackageDetail_AdditionalDefaultValuesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseInstalledPackageSummary(): InstalledPackageSummary { - return { - installedPackageRef: undefined, - name: "", - pkgVersionReference: undefined, - currentVersion: undefined, - iconUrl: "", - pkgDisplayName: "", - shortDescription: "", - latestMatchingVersion: undefined, - latestVersion: undefined, - status: undefined, - }; -} - -export const InstalledPackageSummary = { - encode(message: InstalledPackageSummary, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - if (message.pkgVersionReference !== undefined) { - VersionReference.encode(message.pkgVersionReference, writer.uint32(26).fork()).ldelim(); - } - if (message.currentVersion !== undefined) { - PackageAppVersion.encode(message.currentVersion, writer.uint32(34).fork()).ldelim(); - } - if (message.iconUrl !== "") { - writer.uint32(42).string(message.iconUrl); - } - if (message.pkgDisplayName !== "") { - writer.uint32(50).string(message.pkgDisplayName); - } - if (message.shortDescription !== "") { - writer.uint32(58).string(message.shortDescription); - } - if (message.latestMatchingVersion !== undefined) { - PackageAppVersion.encode(message.latestMatchingVersion, writer.uint32(66).fork()).ldelim(); - } - if (message.latestVersion !== undefined) { - PackageAppVersion.encode(message.latestVersion, writer.uint32(74).fork()).ldelim(); - } - if (message.status !== undefined) { - InstalledPackageStatus.encode(message.status, writer.uint32(82).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InstalledPackageSummary { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstalledPackageSummary(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.pkgVersionReference = VersionReference.decode(reader, reader.uint32()); - break; - case 4: - message.currentVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 5: - message.iconUrl = reader.string(); - break; - case 6: - message.pkgDisplayName = reader.string(); - break; - case 7: - message.shortDescription = reader.string(); - break; - case 8: - message.latestMatchingVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 9: - message.latestVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 10: - message.status = InstalledPackageStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): InstalledPackageSummary { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - pkgVersionReference: isSet(object.pkgVersionReference) - ? VersionReference.fromJSON(object.pkgVersionReference) - : undefined, - currentVersion: isSet(object.currentVersion) - ? PackageAppVersion.fromJSON(object.currentVersion) - : undefined, - iconUrl: isSet(object.iconUrl) ? String(object.iconUrl) : "", - pkgDisplayName: isSet(object.pkgDisplayName) ? String(object.pkgDisplayName) : "", - shortDescription: isSet(object.shortDescription) ? String(object.shortDescription) : "", - latestMatchingVersion: isSet(object.latestMatchingVersion) - ? PackageAppVersion.fromJSON(object.latestMatchingVersion) - : undefined, - latestVersion: isSet(object.latestVersion) - ? PackageAppVersion.fromJSON(object.latestVersion) - : undefined, - status: isSet(object.status) ? InstalledPackageStatus.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: InstalledPackageSummary): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.pkgVersionReference !== undefined && - (obj.pkgVersionReference = message.pkgVersionReference - ? VersionReference.toJSON(message.pkgVersionReference) - : undefined); - message.currentVersion !== undefined && - (obj.currentVersion = message.currentVersion - ? PackageAppVersion.toJSON(message.currentVersion) - : undefined); - message.iconUrl !== undefined && (obj.iconUrl = message.iconUrl); - message.pkgDisplayName !== undefined && (obj.pkgDisplayName = message.pkgDisplayName); - message.shortDescription !== undefined && (obj.shortDescription = message.shortDescription); - message.latestMatchingVersion !== undefined && - (obj.latestMatchingVersion = message.latestMatchingVersion - ? PackageAppVersion.toJSON(message.latestMatchingVersion) - : undefined); - message.latestVersion !== undefined && - (obj.latestVersion = message.latestVersion - ? PackageAppVersion.toJSON(message.latestVersion) - : undefined); - message.status !== undefined && - (obj.status = message.status ? InstalledPackageStatus.toJSON(message.status) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): InstalledPackageSummary { - return InstalledPackageSummary.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): InstalledPackageSummary { - const message = createBaseInstalledPackageSummary(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - message.name = object.name ?? ""; - message.pkgVersionReference = - object.pkgVersionReference !== undefined && object.pkgVersionReference !== null - ? VersionReference.fromPartial(object.pkgVersionReference) - : undefined; - message.currentVersion = - object.currentVersion !== undefined && object.currentVersion !== null - ? PackageAppVersion.fromPartial(object.currentVersion) - : undefined; - message.iconUrl = object.iconUrl ?? ""; - message.pkgDisplayName = object.pkgDisplayName ?? ""; - message.shortDescription = object.shortDescription ?? ""; - message.latestMatchingVersion = - object.latestMatchingVersion !== undefined && object.latestMatchingVersion !== null - ? PackageAppVersion.fromPartial(object.latestMatchingVersion) - : undefined; - message.latestVersion = - object.latestVersion !== undefined && object.latestVersion !== null - ? PackageAppVersion.fromPartial(object.latestVersion) - : undefined; - message.status = - object.status !== undefined && object.status !== null - ? InstalledPackageStatus.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseInstalledPackageDetail(): InstalledPackageDetail { - return { - installedPackageRef: undefined, - pkgVersionReference: undefined, - name: "", - currentVersion: undefined, - valuesApplied: "", - reconciliationOptions: undefined, - status: undefined, - postInstallationNotes: "", - availablePackageRef: undefined, - latestMatchingVersion: undefined, - latestVersion: undefined, - customDetail: undefined, - }; -} - -export const InstalledPackageDetail = { - encode(message: InstalledPackageDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.pkgVersionReference !== undefined) { - VersionReference.encode(message.pkgVersionReference, writer.uint32(18).fork()).ldelim(); - } - if (message.name !== "") { - writer.uint32(26).string(message.name); - } - if (message.currentVersion !== undefined) { - PackageAppVersion.encode(message.currentVersion, writer.uint32(34).fork()).ldelim(); - } - if (message.valuesApplied !== "") { - writer.uint32(42).string(message.valuesApplied); - } - if (message.reconciliationOptions !== undefined) { - ReconciliationOptions.encode( - message.reconciliationOptions, - writer.uint32(50).fork(), - ).ldelim(); - } - if (message.status !== undefined) { - InstalledPackageStatus.encode(message.status, writer.uint32(58).fork()).ldelim(); - } - if (message.postInstallationNotes !== "") { - writer.uint32(66).string(message.postInstallationNotes); - } - if (message.availablePackageRef !== undefined) { - AvailablePackageReference.encode( - message.availablePackageRef, - writer.uint32(74).fork(), - ).ldelim(); - } - if (message.latestMatchingVersion !== undefined) { - PackageAppVersion.encode(message.latestMatchingVersion, writer.uint32(82).fork()).ldelim(); - } - if (message.latestVersion !== undefined) { - PackageAppVersion.encode(message.latestVersion, writer.uint32(90).fork()).ldelim(); - } - if (message.customDetail !== undefined) { - Any.encode(message.customDetail, writer.uint32(114).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InstalledPackageDetail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstalledPackageDetail(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.pkgVersionReference = VersionReference.decode(reader, reader.uint32()); - break; - case 3: - message.name = reader.string(); - break; - case 4: - message.currentVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 5: - message.valuesApplied = reader.string(); - break; - case 6: - message.reconciliationOptions = ReconciliationOptions.decode(reader, reader.uint32()); - break; - case 7: - message.status = InstalledPackageStatus.decode(reader, reader.uint32()); - break; - case 8: - message.postInstallationNotes = reader.string(); - break; - case 9: - message.availablePackageRef = AvailablePackageReference.decode(reader, reader.uint32()); - break; - case 10: - message.latestMatchingVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 11: - message.latestVersion = PackageAppVersion.decode(reader, reader.uint32()); - break; - case 14: - message.customDetail = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): InstalledPackageDetail { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - pkgVersionReference: isSet(object.pkgVersionReference) - ? VersionReference.fromJSON(object.pkgVersionReference) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - currentVersion: isSet(object.currentVersion) - ? PackageAppVersion.fromJSON(object.currentVersion) - : undefined, - valuesApplied: isSet(object.valuesApplied) ? String(object.valuesApplied) : "", - reconciliationOptions: isSet(object.reconciliationOptions) - ? ReconciliationOptions.fromJSON(object.reconciliationOptions) - : undefined, - status: isSet(object.status) ? InstalledPackageStatus.fromJSON(object.status) : undefined, - postInstallationNotes: isSet(object.postInstallationNotes) - ? String(object.postInstallationNotes) - : "", - availablePackageRef: isSet(object.availablePackageRef) - ? AvailablePackageReference.fromJSON(object.availablePackageRef) - : undefined, - latestMatchingVersion: isSet(object.latestMatchingVersion) - ? PackageAppVersion.fromJSON(object.latestMatchingVersion) - : undefined, - latestVersion: isSet(object.latestVersion) - ? PackageAppVersion.fromJSON(object.latestVersion) - : undefined, - customDetail: isSet(object.customDetail) ? Any.fromJSON(object.customDetail) : undefined, - }; - }, - - toJSON(message: InstalledPackageDetail): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - message.pkgVersionReference !== undefined && - (obj.pkgVersionReference = message.pkgVersionReference - ? VersionReference.toJSON(message.pkgVersionReference) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.currentVersion !== undefined && - (obj.currentVersion = message.currentVersion - ? PackageAppVersion.toJSON(message.currentVersion) - : undefined); - message.valuesApplied !== undefined && (obj.valuesApplied = message.valuesApplied); - message.reconciliationOptions !== undefined && - (obj.reconciliationOptions = message.reconciliationOptions - ? ReconciliationOptions.toJSON(message.reconciliationOptions) - : undefined); - message.status !== undefined && - (obj.status = message.status ? InstalledPackageStatus.toJSON(message.status) : undefined); - message.postInstallationNotes !== undefined && - (obj.postInstallationNotes = message.postInstallationNotes); - message.availablePackageRef !== undefined && - (obj.availablePackageRef = message.availablePackageRef - ? AvailablePackageReference.toJSON(message.availablePackageRef) - : undefined); - message.latestMatchingVersion !== undefined && - (obj.latestMatchingVersion = message.latestMatchingVersion - ? PackageAppVersion.toJSON(message.latestMatchingVersion) - : undefined); - message.latestVersion !== undefined && - (obj.latestVersion = message.latestVersion - ? PackageAppVersion.toJSON(message.latestVersion) - : undefined); - message.customDetail !== undefined && - (obj.customDetail = message.customDetail ? Any.toJSON(message.customDetail) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): InstalledPackageDetail { - return InstalledPackageDetail.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): InstalledPackageDetail { - const message = createBaseInstalledPackageDetail(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - message.pkgVersionReference = - object.pkgVersionReference !== undefined && object.pkgVersionReference !== null - ? VersionReference.fromPartial(object.pkgVersionReference) - : undefined; - message.name = object.name ?? ""; - message.currentVersion = - object.currentVersion !== undefined && object.currentVersion !== null - ? PackageAppVersion.fromPartial(object.currentVersion) - : undefined; - message.valuesApplied = object.valuesApplied ?? ""; - message.reconciliationOptions = - object.reconciliationOptions !== undefined && object.reconciliationOptions !== null - ? ReconciliationOptions.fromPartial(object.reconciliationOptions) - : undefined; - message.status = - object.status !== undefined && object.status !== null - ? InstalledPackageStatus.fromPartial(object.status) - : undefined; - message.postInstallationNotes = object.postInstallationNotes ?? ""; - message.availablePackageRef = - object.availablePackageRef !== undefined && object.availablePackageRef !== null - ? AvailablePackageReference.fromPartial(object.availablePackageRef) - : undefined; - message.latestMatchingVersion = - object.latestMatchingVersion !== undefined && object.latestMatchingVersion !== null - ? PackageAppVersion.fromPartial(object.latestMatchingVersion) - : undefined; - message.latestVersion = - object.latestVersion !== undefined && object.latestVersion !== null - ? PackageAppVersion.fromPartial(object.latestVersion) - : undefined; - message.customDetail = - object.customDetail !== undefined && object.customDetail !== null - ? Any.fromPartial(object.customDetail) - : undefined; - return message; - }, -}; - -function createBaseContext(): Context { - return { cluster: "", namespace: "" }; -} - -export const Context = { - encode(message: Context, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.cluster !== "") { - writer.uint32(10).string(message.cluster); - } - if (message.namespace !== "") { - writer.uint32(18).string(message.namespace); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Context { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseContext(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.cluster = reader.string(); - break; - case 2: - message.namespace = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): Context { - return { - cluster: isSet(object.cluster) ? String(object.cluster) : "", - namespace: isSet(object.namespace) ? String(object.namespace) : "", - }; - }, - - toJSON(message: Context): unknown { - const obj: any = {}; - message.cluster !== undefined && (obj.cluster = message.cluster); - message.namespace !== undefined && (obj.namespace = message.namespace); - return obj; - }, - - create, I>>(base?: I): Context { - return Context.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): Context { - const message = createBaseContext(); - message.cluster = object.cluster ?? ""; - message.namespace = object.namespace ?? ""; - return message; - }, -}; - -function createBaseAvailablePackageReference(): AvailablePackageReference { - return { context: undefined, identifier: "", plugin: undefined }; -} - -export const AvailablePackageReference = { - encode(message: AvailablePackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.identifier !== "") { - writer.uint32(18).string(message.identifier); - } - if (message.plugin !== undefined) { - Plugin.encode(message.plugin, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AvailablePackageReference { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAvailablePackageReference(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.identifier = reader.string(); - break; - case 3: - message.plugin = Plugin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): AvailablePackageReference { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - identifier: isSet(object.identifier) ? String(object.identifier) : "", - plugin: isSet(object.plugin) ? Plugin.fromJSON(object.plugin) : undefined, - }; - }, - - toJSON(message: AvailablePackageReference): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.identifier !== undefined && (obj.identifier = message.identifier); - message.plugin !== undefined && - (obj.plugin = message.plugin ? Plugin.toJSON(message.plugin) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): AvailablePackageReference { - return AvailablePackageReference.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): AvailablePackageReference { - const message = createBaseAvailablePackageReference(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.identifier = object.identifier ?? ""; - message.plugin = - object.plugin !== undefined && object.plugin !== null - ? Plugin.fromPartial(object.plugin) - : undefined; - return message; - }, -}; - -function createBaseMaintainer(): Maintainer { - return { name: "", email: "" }; -} - -export const Maintainer = { - encode(message: Maintainer, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.email !== "") { - writer.uint32(18).string(message.email); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Maintainer { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMaintainer(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.email = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): Maintainer { - return { - name: isSet(object.name) ? String(object.name) : "", - email: isSet(object.email) ? String(object.email) : "", - }; - }, - - toJSON(message: Maintainer): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.email !== undefined && (obj.email = message.email); - return obj; - }, - - create, I>>(base?: I): Maintainer { - return Maintainer.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): Maintainer { - const message = createBaseMaintainer(); - message.name = object.name ?? ""; - message.email = object.email ?? ""; - return message; - }, -}; - -function createBaseFilterOptions(): FilterOptions { - return { query: "", categories: [], repositories: [], pkgVersion: "", appVersion: "" }; -} - -export const FilterOptions = { - encode(message: FilterOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.query !== "") { - writer.uint32(10).string(message.query); - } - for (const v of message.categories) { - writer.uint32(18).string(v!); - } - for (const v of message.repositories) { - writer.uint32(26).string(v!); - } - if (message.pkgVersion !== "") { - writer.uint32(34).string(message.pkgVersion); - } - if (message.appVersion !== "") { - writer.uint32(42).string(message.appVersion); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FilterOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.query = reader.string(); - break; - case 2: - message.categories.push(reader.string()); - break; - case 3: - message.repositories.push(reader.string()); - break; - case 4: - message.pkgVersion = reader.string(); - break; - case 5: - message.appVersion = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): FilterOptions { - return { - query: isSet(object.query) ? String(object.query) : "", - categories: Array.isArray(object?.categories) - ? object.categories.map((e: any) => String(e)) - : [], - repositories: Array.isArray(object?.repositories) - ? object.repositories.map((e: any) => String(e)) - : [], - pkgVersion: isSet(object.pkgVersion) ? String(object.pkgVersion) : "", - appVersion: isSet(object.appVersion) ? String(object.appVersion) : "", - }; - }, - - toJSON(message: FilterOptions): unknown { - const obj: any = {}; - message.query !== undefined && (obj.query = message.query); - if (message.categories) { - obj.categories = message.categories.map(e => e); - } else { - obj.categories = []; - } - if (message.repositories) { - obj.repositories = message.repositories.map(e => e); - } else { - obj.repositories = []; - } - message.pkgVersion !== undefined && (obj.pkgVersion = message.pkgVersion); - message.appVersion !== undefined && (obj.appVersion = message.appVersion); - return obj; - }, - - create, I>>(base?: I): FilterOptions { - return FilterOptions.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): FilterOptions { - const message = createBaseFilterOptions(); - message.query = object.query ?? ""; - message.categories = object.categories?.map(e => e) || []; - message.repositories = object.repositories?.map(e => e) || []; - message.pkgVersion = object.pkgVersion ?? ""; - message.appVersion = object.appVersion ?? ""; - return message; - }, -}; - -function createBasePaginationOptions(): PaginationOptions { - return { pageToken: "", pageSize: 0 }; -} - -export const PaginationOptions = { - encode(message: PaginationOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pageToken !== "") { - writer.uint32(10).string(message.pageToken); - } - if (message.pageSize !== 0) { - writer.uint32(16).int32(message.pageSize); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PaginationOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePaginationOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pageToken = reader.string(); - break; - case 2: - message.pageSize = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PaginationOptions { - return { - pageToken: isSet(object.pageToken) ? String(object.pageToken) : "", - pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0, - }; - }, - - toJSON(message: PaginationOptions): unknown { - const obj: any = {}; - message.pageToken !== undefined && (obj.pageToken = message.pageToken); - message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize)); - return obj; - }, - - create, I>>(base?: I): PaginationOptions { - return PaginationOptions.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): PaginationOptions { - const message = createBasePaginationOptions(); - message.pageToken = object.pageToken ?? ""; - message.pageSize = object.pageSize ?? 0; - return message; - }, -}; - -function createBaseInstalledPackageReference(): InstalledPackageReference { - return { context: undefined, identifier: "", plugin: undefined }; -} - -export const InstalledPackageReference = { - encode(message: InstalledPackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.identifier !== "") { - writer.uint32(18).string(message.identifier); - } - if (message.plugin !== undefined) { - Plugin.encode(message.plugin, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InstalledPackageReference { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstalledPackageReference(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.identifier = reader.string(); - break; - case 3: - message.plugin = Plugin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): InstalledPackageReference { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - identifier: isSet(object.identifier) ? String(object.identifier) : "", - plugin: isSet(object.plugin) ? Plugin.fromJSON(object.plugin) : undefined, - }; - }, - - toJSON(message: InstalledPackageReference): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.identifier !== undefined && (obj.identifier = message.identifier); - message.plugin !== undefined && - (obj.plugin = message.plugin ? Plugin.toJSON(message.plugin) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): InstalledPackageReference { - return InstalledPackageReference.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): InstalledPackageReference { - const message = createBaseInstalledPackageReference(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.identifier = object.identifier ?? ""; - message.plugin = - object.plugin !== undefined && object.plugin !== null - ? Plugin.fromPartial(object.plugin) - : undefined; - return message; - }, -}; - -function createBaseVersionReference(): VersionReference { - return { version: "" }; -} - -export const VersionReference = { - encode(message: VersionReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.version !== "") { - writer.uint32(10).string(message.version); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VersionReference { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVersionReference(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.version = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): VersionReference { - return { version: isSet(object.version) ? String(object.version) : "" }; - }, - - toJSON(message: VersionReference): unknown { - const obj: any = {}; - message.version !== undefined && (obj.version = message.version); - return obj; - }, - - create, I>>(base?: I): VersionReference { - return VersionReference.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): VersionReference { - const message = createBaseVersionReference(); - message.version = object.version ?? ""; - return message; - }, -}; - -function createBaseInstalledPackageStatus(): InstalledPackageStatus { - return { ready: false, reason: 0, userReason: "" }; -} - -export const InstalledPackageStatus = { - encode(message: InstalledPackageStatus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ready === true) { - writer.uint32(8).bool(message.ready); - } - if (message.reason !== 0) { - writer.uint32(16).int32(message.reason); - } - if (message.userReason !== "") { - writer.uint32(26).string(message.userReason); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InstalledPackageStatus { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstalledPackageStatus(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ready = reader.bool(); - break; - case 2: - message.reason = reader.int32() as any; - break; - case 3: - message.userReason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): InstalledPackageStatus { - return { - ready: isSet(object.ready) ? Boolean(object.ready) : false, - reason: isSet(object.reason) ? installedPackageStatus_StatusReasonFromJSON(object.reason) : 0, - userReason: isSet(object.userReason) ? String(object.userReason) : "", - }; - }, - - toJSON(message: InstalledPackageStatus): unknown { - const obj: any = {}; - message.ready !== undefined && (obj.ready = message.ready); - message.reason !== undefined && - (obj.reason = installedPackageStatus_StatusReasonToJSON(message.reason)); - message.userReason !== undefined && (obj.userReason = message.userReason); - return obj; - }, - - create, I>>( - base?: I, - ): InstalledPackageStatus { - return InstalledPackageStatus.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): InstalledPackageStatus { - const message = createBaseInstalledPackageStatus(); - message.ready = object.ready ?? false; - message.reason = object.reason ?? 0; - message.userReason = object.userReason ?? ""; - return message; - }, -}; - -function createBaseReconciliationOptions(): ReconciliationOptions { - return { interval: "", suspend: false, serviceAccountName: "" }; -} - -export const ReconciliationOptions = { - encode(message: ReconciliationOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.interval !== "") { - writer.uint32(10).string(message.interval); - } - if (message.suspend === true) { - writer.uint32(16).bool(message.suspend); - } - if (message.serviceAccountName !== "") { - writer.uint32(26).string(message.serviceAccountName); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ReconciliationOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseReconciliationOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.interval = reader.string(); - break; - case 2: - message.suspend = reader.bool(); - break; - case 3: - message.serviceAccountName = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): ReconciliationOptions { - return { - interval: isSet(object.interval) ? String(object.interval) : "", - suspend: isSet(object.suspend) ? Boolean(object.suspend) : false, - serviceAccountName: isSet(object.serviceAccountName) ? String(object.serviceAccountName) : "", - }; - }, - - toJSON(message: ReconciliationOptions): unknown { - const obj: any = {}; - message.interval !== undefined && (obj.interval = message.interval); - message.suspend !== undefined && (obj.suspend = message.suspend); - message.serviceAccountName !== undefined && - (obj.serviceAccountName = message.serviceAccountName); - return obj; - }, - - create, I>>(base?: I): ReconciliationOptions { - return ReconciliationOptions.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): ReconciliationOptions { - const message = createBaseReconciliationOptions(); - message.interval = object.interval ?? ""; - message.suspend = object.suspend ?? false; - message.serviceAccountName = object.serviceAccountName ?? ""; - return message; - }, -}; - -function createBasePackageAppVersion(): PackageAppVersion { - return { pkgVersion: "", appVersion: "" }; -} - -export const PackageAppVersion = { - encode(message: PackageAppVersion, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.pkgVersion !== "") { - writer.uint32(10).string(message.pkgVersion); - } - if (message.appVersion !== "") { - writer.uint32(18).string(message.appVersion); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageAppVersion { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageAppVersion(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.pkgVersion = reader.string(); - break; - case 2: - message.appVersion = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageAppVersion { - return { - pkgVersion: isSet(object.pkgVersion) ? String(object.pkgVersion) : "", - appVersion: isSet(object.appVersion) ? String(object.appVersion) : "", - }; - }, - - toJSON(message: PackageAppVersion): unknown { - const obj: any = {}; - message.pkgVersion !== undefined && (obj.pkgVersion = message.pkgVersion); - message.appVersion !== undefined && (obj.appVersion = message.appVersion); - return obj; - }, - - create, I>>(base?: I): PackageAppVersion { - return PackageAppVersion.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): PackageAppVersion { - const message = createBasePackageAppVersion(); - message.pkgVersion = object.pkgVersion ?? ""; - message.appVersion = object.appVersion ?? ""; - return message; - }, -}; - -function createBaseResourceRef(): ResourceRef { - return { apiVersion: "", kind: "", name: "", namespace: "" }; -} - -export const ResourceRef = { - encode(message: ResourceRef, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.apiVersion !== "") { - writer.uint32(10).string(message.apiVersion); - } - if (message.kind !== "") { - writer.uint32(18).string(message.kind); - } - if (message.name !== "") { - writer.uint32(26).string(message.name); - } - if (message.namespace !== "") { - writer.uint32(34).string(message.namespace); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ResourceRef { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResourceRef(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.apiVersion = reader.string(); - break; - case 2: - message.kind = reader.string(); - break; - case 3: - message.name = reader.string(); - break; - case 4: - message.namespace = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): ResourceRef { - return { - apiVersion: isSet(object.apiVersion) ? String(object.apiVersion) : "", - kind: isSet(object.kind) ? String(object.kind) : "", - name: isSet(object.name) ? String(object.name) : "", - namespace: isSet(object.namespace) ? String(object.namespace) : "", - }; - }, - - toJSON(message: ResourceRef): unknown { - const obj: any = {}; - message.apiVersion !== undefined && (obj.apiVersion = message.apiVersion); - message.kind !== undefined && (obj.kind = message.kind); - message.name !== undefined && (obj.name = message.name); - message.namespace !== undefined && (obj.namespace = message.namespace); - return obj; - }, - - create, I>>(base?: I): ResourceRef { - return ResourceRef.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): ResourceRef { - const message = createBaseResourceRef(); - message.apiVersion = object.apiVersion ?? ""; - message.kind = object.kind ?? ""; - message.name = object.name ?? ""; - message.namespace = object.namespace ?? ""; - return message; - }, -}; - -/** Each packages v1alpha1 plugin must implement at least the following rpcs: */ -export interface PackagesService { - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class PackagesServiceClientImpl implements PackagesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.GetAvailablePackageSummaries = this.GetAvailablePackageSummaries.bind(this); - this.GetAvailablePackageDetail = this.GetAvailablePackageDetail.bind(this); - this.GetAvailablePackageVersions = this.GetAvailablePackageVersions.bind(this); - this.GetInstalledPackageSummaries = this.GetInstalledPackageSummaries.bind(this); - this.GetInstalledPackageDetail = this.GetInstalledPackageDetail.bind(this); - this.CreateInstalledPackage = this.CreateInstalledPackage.bind(this); - this.UpdateInstalledPackage = this.UpdateInstalledPackage.bind(this); - this.DeleteInstalledPackage = this.DeleteInstalledPackage.bind(this); - this.GetInstalledPackageResourceRefs = this.GetInstalledPackageResourceRefs.bind(this); - } - - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceGetAvailablePackageSummariesDesc, - GetAvailablePackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceGetAvailablePackageDetailDesc, - GetAvailablePackageDetailRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceGetAvailablePackageVersionsDesc, - GetAvailablePackageVersionsRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceGetInstalledPackageSummariesDesc, - GetInstalledPackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceGetInstalledPackageDetailDesc, - GetInstalledPackageDetailRequest.fromPartial(request), - metadata, - ); - } - - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceCreateInstalledPackageDesc, - CreateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceUpdateInstalledPackageDesc, - UpdateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceDeleteInstalledPackageDesc, - DeleteInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PackagesServiceGetInstalledPackageResourceRefsDesc, - GetInstalledPackageResourceRefsRequest.fromPartial(request), - metadata, - ); - } -} - -export const PackagesServiceDesc = { - serviceName: "kubeappsapis.core.packages.v1alpha1.PackagesService", -}; - -export const PackagesServiceGetAvailablePackageSummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageSummaries", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceGetAvailablePackageDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageDetail", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceGetAvailablePackageVersionsDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageVersions", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageVersionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageVersionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceGetInstalledPackageSummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageSummaries", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceGetInstalledPackageDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageDetail", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceCreateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "CreateInstalledPackage", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CreateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CreateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceUpdateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "UpdateInstalledPackage", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceDeleteInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "DeleteInstalledPackage", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeleteInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeleteInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const PackagesServiceGetInstalledPackageResourceRefsDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageResourceRefs", - service: PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageResourceRefsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageResourceRefsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/repositories.ts b/dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/repositories.ts deleted file mode 100644 index 459dc5d3ef3..00000000000 --- a/dashboard/src/gen/kubeappsapis/core/packages/v1alpha1/repositories.ts +++ /dev/null @@ -1,3487 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import _m0 from "protobufjs/minimal"; -import { Any } from "../../../../google/protobuf/any"; -import { Plugin } from "../../plugins/v1alpha1/plugins"; -import { Context } from "./packages"; - -export const protobufPackage = "kubeappsapis.core.packages.v1alpha1"; - -/** - * AddPackageRepositoryRequest - * - * Request for AddPackageRepository - */ -export interface AddPackageRepositoryRequest { - /** - * The target context where the package repository is intended to be - * installed. - */ - context?: Context; - /** A user-provided name for the package repository (e.g. bitnami) */ - name: string; - /** A user-provided description. Optional */ - description: string; - /** - * Whether this repository is global or namespace-scoped. Optional. - * By default, the value is false, i.e. the repository is global - */ - namespaceScoped: boolean; - /** - * Package storage type - * In general, each plug-in will define an acceptable set of valid types - * - for direct helm plug-in valid values are: "helm" and "oci" - * - for flux plug-in valid values are: "helm" and "oci". In the - * future, we may add support for git and/or AWS s3-style buckets - */ - type: string; - /** - * A URL identifying the package repository location. Must contain at - * least a protocol and host - */ - url: string; - /** - * The interval at which to check the upstream for updates (in time+unit) - * Some plugins may, addionally, support other formats, for instance, - * a cron expression. - * e.g., "* /10 * * * *" will be equivalent to "10m" - * Optional. Defaults to 10m if not specified - */ - interval: string; - /** TLS-specific parameters for connecting to a repository. Optional */ - tlsConfig?: PackageRepositoryTlsConfig; - /** authentication parameters for connecting to a repository. Optional */ - auth?: PackageRepositoryAuth; - /** - * The plugin used to interact with this package repository. - * This field should be omitted when the request is in the context of a - * specific plugin. - */ - plugin?: Plugin; - /** - * Custom data added by the plugin - * A plugin can define custom details for data which is not yet, or - * never will be specified in the core AddPackageRepositoryRequest - * fields. The use of an `Any` field means that each plugin can define - * the structure of this message as required, while still satisfying the - * core interface. - * See https://developers.google.com/protocol-buffers/docs/proto3#any - * Just for reference, some of the examples that have been chosen not to - * be part of the core API but rather plugin-specific details are: - * direct-helm: - * - image pull secrets - * - list of oci repositories - * - filter rules - * - sync job pod template - */ - customDetail?: Any; -} - -/** PackageRepositoryTlsConfig */ -export interface PackageRepositoryTlsConfig { - /** - * whether or not to skip TLS verification - * note that fluxv2 does not currently support this and will raise an - * error should this flag be set to true - */ - insecureSkipVerify: boolean; - /** certificate authority. Optional */ - certAuthority?: string | undefined; - /** a reference to an existing secret that contains custom CA */ - secretRef?: SecretKeyReference | undefined; -} - -/** - * PackageRepositoryAuth - * - * Authentication/authorization to provide client's identity when connecting - * to a package repository. - * There are 6 total distinct use cases we may support: - * 1) None (Public) - * 2) Basic Auth - * 3) Bearer Token - * 4) Custom Authorization Header - * 5) Docker Registry Credentials (for OCI only) - * 6) TLS certificate and key - * - * Note that (1)-(4) may be done over HTTP or HTTPs without any custom - * certificates or certificate authority - * (1) is handled by not not having PackageRepositoryAuth field on - * the parent object - * a given plug-in may or may not support a given authentication type. - * For example - * - direct-helm plug-in does not currently support (6), while flux does - * - flux plug-in does not support (3) or (4) while direct-helm does - */ -export interface PackageRepositoryAuth { - type: PackageRepositoryAuth_PackageRepositoryAuthType; - /** username and plain text password */ - usernamePassword?: UsernamePassword | undefined; - /** certificate and key for TLS-based authentication */ - tlsCertKey?: TlsCertKey | undefined; - /** docker credentials */ - dockerCreds?: DockerCredentials | undefined; - /** - * for Bearer Auth token value - * for Custom Auth, complete value of "Authorization" header - */ - header?: string | undefined; - /** a reference to an existing secret */ - secretRef?: SecretKeyReference | undefined; - /** SSH credentials */ - sshCreds?: SshCredentials | undefined; - /** opaque credentials */ - opaqueCreds?: OpaqueCredentials | undefined; - /** - * pass_credentials allows the credentials from the SecretRef to be passed - * on to a host that does not match the host as defined in URL. - * This flag controls whether or not it is allowed to passing credentials - * with requests to other domains linked from the repository. - * This may be needed if the host of the advertised chart URLs in the - * index differs from the defined URL. Optional - */ - passCredentials: boolean; -} - -export enum PackageRepositoryAuth_PackageRepositoryAuthType { - PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED = 0, - /** PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH - uses UsernamePassword */ - PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH = 1, - /** PACKAGE_REPOSITORY_AUTH_TYPE_TLS - uses TlsCertKey */ - PACKAGE_REPOSITORY_AUTH_TYPE_TLS = 2, - /** PACKAGE_REPOSITORY_AUTH_TYPE_BEARER - uses header */ - PACKAGE_REPOSITORY_AUTH_TYPE_BEARER = 3, - /** PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER - uses header */ - PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER = 4, - /** PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON - uses DockerCredentials */ - PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON = 5, - /** PACKAGE_REPOSITORY_AUTH_TYPE_SSH - uses SshCredentials */ - PACKAGE_REPOSITORY_AUTH_TYPE_SSH = 6, - /** PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE - uses OpaqueCredentials */ - PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE = 7, - UNRECOGNIZED = -1, -} - -export function packageRepositoryAuth_PackageRepositoryAuthTypeFromJSON( - object: any, -): PackageRepositoryAuth_PackageRepositoryAuthType { - switch (object) { - case 0: - case "PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED; - case 1: - case "PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH; - case 2: - case "PACKAGE_REPOSITORY_AUTH_TYPE_TLS": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_TLS; - case 3: - case "PACKAGE_REPOSITORY_AUTH_TYPE_BEARER": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_BEARER; - case 4: - case "PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER; - case 5: - case "PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON; - case 6: - case "PACKAGE_REPOSITORY_AUTH_TYPE_SSH": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_SSH; - case 7: - case "PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE": - return PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE; - case -1: - case "UNRECOGNIZED": - default: - return PackageRepositoryAuth_PackageRepositoryAuthType.UNRECOGNIZED; - } -} - -export function packageRepositoryAuth_PackageRepositoryAuthTypeToJSON( - object: PackageRepositoryAuth_PackageRepositoryAuthType, -): string { - switch (object) { - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED: - return "PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH: - return "PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_TLS: - return "PACKAGE_REPOSITORY_AUTH_TYPE_TLS"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_BEARER: - return "PACKAGE_REPOSITORY_AUTH_TYPE_BEARER"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER: - return "PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON: - return "PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_SSH: - return "PACKAGE_REPOSITORY_AUTH_TYPE_SSH"; - case PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE: - return "PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE"; - case PackageRepositoryAuth_PackageRepositoryAuthType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** UsernamePassword */ -export interface UsernamePassword { - /** In clear text */ - username: string; - /** In clear text */ - password: string; -} - -/** TlsCertKey */ -export interface TlsCertKey { - /** certificate (identity). In clear text */ - cert: string; - /** certificate key. In clear text */ - key: string; -} - -/** DockerCredentials */ -export interface DockerCredentials { - /** server name */ - server: string; - /** username. */ - username: string; - /** password. In clear text */ - password: string; - /** email address */ - email: string; -} - -/** SshCredentials */ -export interface SshCredentials { - /** private key */ - privateKey: string; - /** known hosts. */ - knownHosts: string; -} - -/** OpaqueCredentials */ -export interface OpaqueCredentials { - /** fields */ - data: { [key: string]: string }; -} - -export interface OpaqueCredentials_DataEntry { - key: string; - value: string; -} - -/** SecretKeyReference */ -export interface SecretKeyReference { - /** - * The name of an existing secret in the same namespace as the object - * that refers to it (e.g. PackageRepository), containing authentication - * credentials for the said package repository. - * - For HTTP/S basic auth the secret must be of type - * "kubernetes.io/basic-auth" or opaque and contain username and - * password fields - * - For TLS the secret must be of type "kubernetes.io/tls" or opaque - * and contain a certFile and keyFile, and/or - * caCert fields. - * - For Bearer or Custom Auth, the secret must be opaque, and - * the key must be provided - * - For Docker Registry Credentials (OCI registries) the secret - * must of of type "kubernetes.io/dockerconfigjson" - * For more details, refer to - * https://kubernetes.io/docs/concepts/configuration/secret/ - */ - name: string; - /** Optional. Must be provided when name refers to an opaque secret */ - key: string; -} - -/** - * GetPackageRepositoryDetailRequest - * - * Request for GetPackageRepositoryDetail - */ -export interface GetPackageRepositoryDetailRequest { - packageRepoRef?: PackageRepositoryReference; -} - -/** - * GetPackageRepositorySummariesRequest - * - * Request for PackageRepositorySummary - */ -export interface GetPackageRepositorySummariesRequest { - /** The context (cluster/namespace) for the request. */ - context?: Context; -} - -/** - * UpdatePackageRepositoryRequest - * - * Request for UpdatePackageRepository - */ -export interface UpdatePackageRepositoryRequest { - /** - * A reference uniquely identifying the package repository being updated. - * The only required field - */ - packageRepoRef?: PackageRepositoryReference; - /** URL identifying the package repository location. */ - url: string; - /** A user-provided description. */ - description: string; - /** - * The interval at which to check the upstream for updates (in time+unit) - * Some plugins may, addionally, support other formats, for instance, - * a cron expression. - * e.g., "* /10 * * * *" will be equivalent to "10m" - * Optional. Defaults to 10m if not specified - */ - interval: string; - /** TLS-specific parameters for connecting to a repository. Optional */ - tlsConfig?: PackageRepositoryTlsConfig; - /** authentication parameters for connecting to a repository. Optional */ - auth?: PackageRepositoryAuth; - /** - * Custom data added by the plugin - * A plugin can define custom details for data which is not yet, or - * never will be specified in the core AddPackageRepositoryRequest - * fields. The use of an `Any` field means that each plugin can define - * the structure of this message as required, while still satisfying the - * core interface. - * See https://developers.google.com/protocol-buffers/docs/proto3#any - * Just for reference, some of the examples that have been chosen not to - * be part of the core API but rather plugin-specific details are: - * direct-helm: - * - image pull secrets - * - list of oci repositories - * - filter rules - * - sync job pod template - */ - customDetail?: Any; -} - -/** - * DeletePackageRepositoryRequest - * - * Request for DeletePackageRepository - */ -export interface DeletePackageRepositoryRequest { - packageRepoRef?: PackageRepositoryReference; -} - -/** - * PackageRepositoryReference - * - * A PackageRepositoryReference has the minimum information required to - * uniquely identify a package repository. - */ -export interface PackageRepositoryReference { - /** The context (cluster/namespace) for the repository. */ - context?: Context; - /** - * The fully qualified identifier for the repository - * (i.e. a unique name for the context). - */ - identifier: string; - /** - * The plugin used to interact with this available package. - * This field should be omitted when the request is in the context of a - * specific plugin. - */ - plugin?: Plugin; -} - -/** - * AddPackageRepositoryResponse - * - * Response for AddPackageRepositoryRequest - */ -export interface AddPackageRepositoryResponse { - /** - * TODO: add example for API docs - * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { - * example: '{"package_repo_ref": {}}' - * }; - */ - packageRepoRef?: PackageRepositoryReference; -} - -/** - * PackageRepositoryStatus - * - * A PackageRepositoryStatus reports on the current status of the repository. - */ -export interface PackageRepositoryStatus { - /** - * Ready - * - * An indication of whether the repository is ready or not - */ - ready: boolean; - /** - * Reason - * - * An enum indicating the reason for the current status. - */ - reason: PackageRepositoryStatus_StatusReason; - /** - * UserReason - * - * Optional text to return for user context, which may be plugin specific. - */ - userReason: string; -} - -/** - * StatusReason - * - * Generic reasons why a package repository may be ready or not. - * These should make sense across different packaging plugins. - */ -export enum PackageRepositoryStatus_StatusReason { - STATUS_REASON_UNSPECIFIED = 0, - STATUS_REASON_SUCCESS = 1, - STATUS_REASON_FAILED = 2, - STATUS_REASON_PENDING = 3, - UNRECOGNIZED = -1, -} - -export function packageRepositoryStatus_StatusReasonFromJSON( - object: any, -): PackageRepositoryStatus_StatusReason { - switch (object) { - case 0: - case "STATUS_REASON_UNSPECIFIED": - return PackageRepositoryStatus_StatusReason.STATUS_REASON_UNSPECIFIED; - case 1: - case "STATUS_REASON_SUCCESS": - return PackageRepositoryStatus_StatusReason.STATUS_REASON_SUCCESS; - case 2: - case "STATUS_REASON_FAILED": - return PackageRepositoryStatus_StatusReason.STATUS_REASON_FAILED; - case 3: - case "STATUS_REASON_PENDING": - return PackageRepositoryStatus_StatusReason.STATUS_REASON_PENDING; - case -1: - case "UNRECOGNIZED": - default: - return PackageRepositoryStatus_StatusReason.UNRECOGNIZED; - } -} - -export function packageRepositoryStatus_StatusReasonToJSON( - object: PackageRepositoryStatus_StatusReason, -): string { - switch (object) { - case PackageRepositoryStatus_StatusReason.STATUS_REASON_UNSPECIFIED: - return "STATUS_REASON_UNSPECIFIED"; - case PackageRepositoryStatus_StatusReason.STATUS_REASON_SUCCESS: - return "STATUS_REASON_SUCCESS"; - case PackageRepositoryStatus_StatusReason.STATUS_REASON_FAILED: - return "STATUS_REASON_FAILED"; - case PackageRepositoryStatus_StatusReason.STATUS_REASON_PENDING: - return "STATUS_REASON_PENDING"; - case PackageRepositoryStatus_StatusReason.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** PackageRepositoryDetail */ -export interface PackageRepositoryDetail { - /** A reference uniquely identifying the package repository. */ - packageRepoRef?: PackageRepositoryReference; - /** A user-provided name for the package repository (e.g. bitnami) */ - name: string; - /** A user-provided description. */ - description: string; - /** Whether this repository is global or namespace-scoped. */ - namespaceScoped: boolean; - /** Package storage type */ - type: string; - /** A URL identifying the package repository location. */ - url: string; - /** - * The interval at which to check the upstream for updates (in time+unit) - * Some plugins may, addionally, support other formats, for instance, - * a cron expression. - * e.g., "* /10 * * * *" will be equivalent to "10m" - */ - interval: string; - /** - * TLS-specific parameters for connecting to a repository. - * If the cert authority was configured for this repository, then in the context - * of GetPackageRepositoryDetail() operation, the PackageRepositoryTlsConfig will ALWAYS - * contain an existing SecretKeyReference, rather that cert_authority field - */ - tlsConfig?: PackageRepositoryTlsConfig; - /** - * authentication parameters for connecting to a repository. - * If Basic Auth or TLS or Docker Creds Auth was configured for this repository, - * then in the context of GetPackageRepositoryDetail() operation, the - * PackageRepositoryAuth will ALWAYS contain an existing SecretKeyReference, - * rather that string values that may have been used when package repository was created - * field - */ - auth?: PackageRepositoryAuth; - /** Custom data added by the plugin */ - customDetail?: Any; - /** - * current status of the repository which can include reconciliation - * status, where relevant. - */ - status?: PackageRepositoryStatus; -} - -/** - * GetPackageRepositoryDetailResponse - * - * Response for GetPackageRepositoryDetail - */ -export interface GetPackageRepositoryDetailResponse { - /** package repository detail */ - detail?: PackageRepositoryDetail; -} - -/** PackageRepositorySummary */ -export interface PackageRepositorySummary { - /** A reference uniquely identifying the package repository. */ - packageRepoRef?: PackageRepositoryReference; - /** A user-provided name for the package repository (e.g. bitnami) */ - name: string; - /** A user-provided description. */ - description: string; - /** Whether this repository is global or namespace-scoped. */ - namespaceScoped: boolean; - /** Package storage type */ - type: string; - /** URL identifying the package repository location. */ - url: string; - /** - * current status of the repository which can include reconciliation - * status, where relevant. - */ - status?: PackageRepositoryStatus; - /** existence of any authentication parameters for connecting to a repository. */ - requiresAuth: boolean; -} - -/** - * GetPackageRepositorySummariesResponse - * - * Response for GetPackageRepositorySummaries - */ -export interface GetPackageRepositorySummariesResponse { - /** List of PackageRepositorySummary */ - packageRepositorySummaries: PackageRepositorySummary[]; -} - -/** - * UpdatePackageRepositoryResponse - * - * Response for UpdatePackageRepository - */ -export interface UpdatePackageRepositoryResponse { - packageRepoRef?: PackageRepositoryReference; -} - -/** - * DeletePackageRepositoryResponse - * - * Response for DeletePackageRepository - */ -export interface DeletePackageRepositoryResponse {} - -export interface GetPackageRepositoryPermissionsRequest { - /** The context (cluster/namespace) for the request */ - context?: Context; -} - -export interface PackageRepositoriesPermissions { - plugin?: Plugin; - /** Permissions at the global namespace (if any) */ - global: { [key: string]: boolean }; - /** Permissions for the namespace */ - namespace: { [key: string]: boolean }; -} - -export interface PackageRepositoriesPermissions_GlobalEntry { - key: string; - value: boolean; -} - -export interface PackageRepositoriesPermissions_NamespaceEntry { - key: string; - value: boolean; -} - -export interface GetPackageRepositoryPermissionsResponse { - permissions: PackageRepositoriesPermissions[]; -} - -function createBaseAddPackageRepositoryRequest(): AddPackageRepositoryRequest { - return { - context: undefined, - name: "", - description: "", - namespaceScoped: false, - type: "", - url: "", - interval: "", - tlsConfig: undefined, - auth: undefined, - plugin: undefined, - customDetail: undefined, - }; -} - -export const AddPackageRepositoryRequest = { - encode( - message: AddPackageRepositoryRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - if (message.description !== "") { - writer.uint32(26).string(message.description); - } - if (message.namespaceScoped === true) { - writer.uint32(32).bool(message.namespaceScoped); - } - if (message.type !== "") { - writer.uint32(42).string(message.type); - } - if (message.url !== "") { - writer.uint32(50).string(message.url); - } - if (message.interval !== "") { - writer.uint32(58).string(message.interval); - } - if (message.tlsConfig !== undefined) { - PackageRepositoryTlsConfig.encode(message.tlsConfig, writer.uint32(66).fork()).ldelim(); - } - if (message.auth !== undefined) { - PackageRepositoryAuth.encode(message.auth, writer.uint32(74).fork()).ldelim(); - } - if (message.plugin !== undefined) { - Plugin.encode(message.plugin, writer.uint32(82).fork()).ldelim(); - } - if (message.customDetail !== undefined) { - Any.encode(message.customDetail, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AddPackageRepositoryRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAddPackageRepositoryRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.namespaceScoped = reader.bool(); - break; - case 5: - message.type = reader.string(); - break; - case 6: - message.url = reader.string(); - break; - case 7: - message.interval = reader.string(); - break; - case 8: - message.tlsConfig = PackageRepositoryTlsConfig.decode(reader, reader.uint32()); - break; - case 9: - message.auth = PackageRepositoryAuth.decode(reader, reader.uint32()); - break; - case 10: - message.plugin = Plugin.decode(reader, reader.uint32()); - break; - case 11: - message.customDetail = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): AddPackageRepositoryRequest { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - namespaceScoped: isSet(object.namespaceScoped) ? Boolean(object.namespaceScoped) : false, - type: isSet(object.type) ? String(object.type) : "", - url: isSet(object.url) ? String(object.url) : "", - interval: isSet(object.interval) ? String(object.interval) : "", - tlsConfig: isSet(object.tlsConfig) - ? PackageRepositoryTlsConfig.fromJSON(object.tlsConfig) - : undefined, - auth: isSet(object.auth) ? PackageRepositoryAuth.fromJSON(object.auth) : undefined, - plugin: isSet(object.plugin) ? Plugin.fromJSON(object.plugin) : undefined, - customDetail: isSet(object.customDetail) ? Any.fromJSON(object.customDetail) : undefined, - }; - }, - - toJSON(message: AddPackageRepositoryRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.name !== undefined && (obj.name = message.name); - message.description !== undefined && (obj.description = message.description); - message.namespaceScoped !== undefined && (obj.namespaceScoped = message.namespaceScoped); - message.type !== undefined && (obj.type = message.type); - message.url !== undefined && (obj.url = message.url); - message.interval !== undefined && (obj.interval = message.interval); - message.tlsConfig !== undefined && - (obj.tlsConfig = message.tlsConfig - ? PackageRepositoryTlsConfig.toJSON(message.tlsConfig) - : undefined); - message.auth !== undefined && - (obj.auth = message.auth ? PackageRepositoryAuth.toJSON(message.auth) : undefined); - message.plugin !== undefined && - (obj.plugin = message.plugin ? Plugin.toJSON(message.plugin) : undefined); - message.customDetail !== undefined && - (obj.customDetail = message.customDetail ? Any.toJSON(message.customDetail) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): AddPackageRepositoryRequest { - return AddPackageRepositoryRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): AddPackageRepositoryRequest { - const message = createBaseAddPackageRepositoryRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.name = object.name ?? ""; - message.description = object.description ?? ""; - message.namespaceScoped = object.namespaceScoped ?? false; - message.type = object.type ?? ""; - message.url = object.url ?? ""; - message.interval = object.interval ?? ""; - message.tlsConfig = - object.tlsConfig !== undefined && object.tlsConfig !== null - ? PackageRepositoryTlsConfig.fromPartial(object.tlsConfig) - : undefined; - message.auth = - object.auth !== undefined && object.auth !== null - ? PackageRepositoryAuth.fromPartial(object.auth) - : undefined; - message.plugin = - object.plugin !== undefined && object.plugin !== null - ? Plugin.fromPartial(object.plugin) - : undefined; - message.customDetail = - object.customDetail !== undefined && object.customDetail !== null - ? Any.fromPartial(object.customDetail) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryTlsConfig(): PackageRepositoryTlsConfig { - return { insecureSkipVerify: false, certAuthority: undefined, secretRef: undefined }; -} - -export const PackageRepositoryTlsConfig = { - encode( - message: PackageRepositoryTlsConfig, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.insecureSkipVerify === true) { - writer.uint32(8).bool(message.insecureSkipVerify); - } - if (message.certAuthority !== undefined) { - writer.uint32(18).string(message.certAuthority); - } - if (message.secretRef !== undefined) { - SecretKeyReference.encode(message.secretRef, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryTlsConfig { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryTlsConfig(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.insecureSkipVerify = reader.bool(); - break; - case 2: - message.certAuthority = reader.string(); - break; - case 3: - message.secretRef = SecretKeyReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryTlsConfig { - return { - insecureSkipVerify: isSet(object.insecureSkipVerify) - ? Boolean(object.insecureSkipVerify) - : false, - certAuthority: isSet(object.certAuthority) ? String(object.certAuthority) : undefined, - secretRef: isSet(object.secretRef) - ? SecretKeyReference.fromJSON(object.secretRef) - : undefined, - }; - }, - - toJSON(message: PackageRepositoryTlsConfig): unknown { - const obj: any = {}; - message.insecureSkipVerify !== undefined && - (obj.insecureSkipVerify = message.insecureSkipVerify); - message.certAuthority !== undefined && (obj.certAuthority = message.certAuthority); - message.secretRef !== undefined && - (obj.secretRef = message.secretRef - ? SecretKeyReference.toJSON(message.secretRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryTlsConfig { - return PackageRepositoryTlsConfig.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryTlsConfig { - const message = createBasePackageRepositoryTlsConfig(); - message.insecureSkipVerify = object.insecureSkipVerify ?? false; - message.certAuthority = object.certAuthority ?? undefined; - message.secretRef = - object.secretRef !== undefined && object.secretRef !== null - ? SecretKeyReference.fromPartial(object.secretRef) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryAuth(): PackageRepositoryAuth { - return { - type: 0, - usernamePassword: undefined, - tlsCertKey: undefined, - dockerCreds: undefined, - header: undefined, - secretRef: undefined, - sshCreds: undefined, - opaqueCreds: undefined, - passCredentials: false, - }; -} - -export const PackageRepositoryAuth = { - encode(message: PackageRepositoryAuth, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.type !== 0) { - writer.uint32(8).int32(message.type); - } - if (message.usernamePassword !== undefined) { - UsernamePassword.encode(message.usernamePassword, writer.uint32(18).fork()).ldelim(); - } - if (message.tlsCertKey !== undefined) { - TlsCertKey.encode(message.tlsCertKey, writer.uint32(26).fork()).ldelim(); - } - if (message.dockerCreds !== undefined) { - DockerCredentials.encode(message.dockerCreds, writer.uint32(34).fork()).ldelim(); - } - if (message.header !== undefined) { - writer.uint32(42).string(message.header); - } - if (message.secretRef !== undefined) { - SecretKeyReference.encode(message.secretRef, writer.uint32(50).fork()).ldelim(); - } - if (message.sshCreds !== undefined) { - SshCredentials.encode(message.sshCreds, writer.uint32(66).fork()).ldelim(); - } - if (message.opaqueCreds !== undefined) { - OpaqueCredentials.encode(message.opaqueCreds, writer.uint32(74).fork()).ldelim(); - } - if (message.passCredentials === true) { - writer.uint32(56).bool(message.passCredentials); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryAuth { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryAuth(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.type = reader.int32() as any; - break; - case 2: - message.usernamePassword = UsernamePassword.decode(reader, reader.uint32()); - break; - case 3: - message.tlsCertKey = TlsCertKey.decode(reader, reader.uint32()); - break; - case 4: - message.dockerCreds = DockerCredentials.decode(reader, reader.uint32()); - break; - case 5: - message.header = reader.string(); - break; - case 6: - message.secretRef = SecretKeyReference.decode(reader, reader.uint32()); - break; - case 8: - message.sshCreds = SshCredentials.decode(reader, reader.uint32()); - break; - case 9: - message.opaqueCreds = OpaqueCredentials.decode(reader, reader.uint32()); - break; - case 7: - message.passCredentials = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryAuth { - return { - type: isSet(object.type) - ? packageRepositoryAuth_PackageRepositoryAuthTypeFromJSON(object.type) - : 0, - usernamePassword: isSet(object.usernamePassword) - ? UsernamePassword.fromJSON(object.usernamePassword) - : undefined, - tlsCertKey: isSet(object.tlsCertKey) ? TlsCertKey.fromJSON(object.tlsCertKey) : undefined, - dockerCreds: isSet(object.dockerCreds) - ? DockerCredentials.fromJSON(object.dockerCreds) - : undefined, - header: isSet(object.header) ? String(object.header) : undefined, - secretRef: isSet(object.secretRef) - ? SecretKeyReference.fromJSON(object.secretRef) - : undefined, - sshCreds: isSet(object.sshCreds) ? SshCredentials.fromJSON(object.sshCreds) : undefined, - opaqueCreds: isSet(object.opaqueCreds) - ? OpaqueCredentials.fromJSON(object.opaqueCreds) - : undefined, - passCredentials: isSet(object.passCredentials) ? Boolean(object.passCredentials) : false, - }; - }, - - toJSON(message: PackageRepositoryAuth): unknown { - const obj: any = {}; - message.type !== undefined && - (obj.type = packageRepositoryAuth_PackageRepositoryAuthTypeToJSON(message.type)); - message.usernamePassword !== undefined && - (obj.usernamePassword = message.usernamePassword - ? UsernamePassword.toJSON(message.usernamePassword) - : undefined); - message.tlsCertKey !== undefined && - (obj.tlsCertKey = message.tlsCertKey ? TlsCertKey.toJSON(message.tlsCertKey) : undefined); - message.dockerCreds !== undefined && - (obj.dockerCreds = message.dockerCreds - ? DockerCredentials.toJSON(message.dockerCreds) - : undefined); - message.header !== undefined && (obj.header = message.header); - message.secretRef !== undefined && - (obj.secretRef = message.secretRef - ? SecretKeyReference.toJSON(message.secretRef) - : undefined); - message.sshCreds !== undefined && - (obj.sshCreds = message.sshCreds ? SshCredentials.toJSON(message.sshCreds) : undefined); - message.opaqueCreds !== undefined && - (obj.opaqueCreds = message.opaqueCreds - ? OpaqueCredentials.toJSON(message.opaqueCreds) - : undefined); - message.passCredentials !== undefined && (obj.passCredentials = message.passCredentials); - return obj; - }, - - create, I>>(base?: I): PackageRepositoryAuth { - return PackageRepositoryAuth.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryAuth { - const message = createBasePackageRepositoryAuth(); - message.type = object.type ?? 0; - message.usernamePassword = - object.usernamePassword !== undefined && object.usernamePassword !== null - ? UsernamePassword.fromPartial(object.usernamePassword) - : undefined; - message.tlsCertKey = - object.tlsCertKey !== undefined && object.tlsCertKey !== null - ? TlsCertKey.fromPartial(object.tlsCertKey) - : undefined; - message.dockerCreds = - object.dockerCreds !== undefined && object.dockerCreds !== null - ? DockerCredentials.fromPartial(object.dockerCreds) - : undefined; - message.header = object.header ?? undefined; - message.secretRef = - object.secretRef !== undefined && object.secretRef !== null - ? SecretKeyReference.fromPartial(object.secretRef) - : undefined; - message.sshCreds = - object.sshCreds !== undefined && object.sshCreds !== null - ? SshCredentials.fromPartial(object.sshCreds) - : undefined; - message.opaqueCreds = - object.opaqueCreds !== undefined && object.opaqueCreds !== null - ? OpaqueCredentials.fromPartial(object.opaqueCreds) - : undefined; - message.passCredentials = object.passCredentials ?? false; - return message; - }, -}; - -function createBaseUsernamePassword(): UsernamePassword { - return { username: "", password: "" }; -} - -export const UsernamePassword = { - encode(message: UsernamePassword, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.username !== "") { - writer.uint32(10).string(message.username); - } - if (message.password !== "") { - writer.uint32(18).string(message.password); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UsernamePassword { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUsernamePassword(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.username = reader.string(); - break; - case 2: - message.password = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): UsernamePassword { - return { - username: isSet(object.username) ? String(object.username) : "", - password: isSet(object.password) ? String(object.password) : "", - }; - }, - - toJSON(message: UsernamePassword): unknown { - const obj: any = {}; - message.username !== undefined && (obj.username = message.username); - message.password !== undefined && (obj.password = message.password); - return obj; - }, - - create, I>>(base?: I): UsernamePassword { - return UsernamePassword.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): UsernamePassword { - const message = createBaseUsernamePassword(); - message.username = object.username ?? ""; - message.password = object.password ?? ""; - return message; - }, -}; - -function createBaseTlsCertKey(): TlsCertKey { - return { cert: "", key: "" }; -} - -export const TlsCertKey = { - encode(message: TlsCertKey, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.cert !== "") { - writer.uint32(10).string(message.cert); - } - if (message.key !== "") { - writer.uint32(18).string(message.key); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): TlsCertKey { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTlsCertKey(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.cert = reader.string(); - break; - case 2: - message.key = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): TlsCertKey { - return { - cert: isSet(object.cert) ? String(object.cert) : "", - key: isSet(object.key) ? String(object.key) : "", - }; - }, - - toJSON(message: TlsCertKey): unknown { - const obj: any = {}; - message.cert !== undefined && (obj.cert = message.cert); - message.key !== undefined && (obj.key = message.key); - return obj; - }, - - create, I>>(base?: I): TlsCertKey { - return TlsCertKey.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): TlsCertKey { - const message = createBaseTlsCertKey(); - message.cert = object.cert ?? ""; - message.key = object.key ?? ""; - return message; - }, -}; - -function createBaseDockerCredentials(): DockerCredentials { - return { server: "", username: "", password: "", email: "" }; -} - -export const DockerCredentials = { - encode(message: DockerCredentials, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.server !== "") { - writer.uint32(10).string(message.server); - } - if (message.username !== "") { - writer.uint32(18).string(message.username); - } - if (message.password !== "") { - writer.uint32(26).string(message.password); - } - if (message.email !== "") { - writer.uint32(34).string(message.email); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DockerCredentials { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDockerCredentials(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.server = reader.string(); - break; - case 2: - message.username = reader.string(); - break; - case 3: - message.password = reader.string(); - break; - case 4: - message.email = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): DockerCredentials { - return { - server: isSet(object.server) ? String(object.server) : "", - username: isSet(object.username) ? String(object.username) : "", - password: isSet(object.password) ? String(object.password) : "", - email: isSet(object.email) ? String(object.email) : "", - }; - }, - - toJSON(message: DockerCredentials): unknown { - const obj: any = {}; - message.server !== undefined && (obj.server = message.server); - message.username !== undefined && (obj.username = message.username); - message.password !== undefined && (obj.password = message.password); - message.email !== undefined && (obj.email = message.email); - return obj; - }, - - create, I>>(base?: I): DockerCredentials { - return DockerCredentials.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): DockerCredentials { - const message = createBaseDockerCredentials(); - message.server = object.server ?? ""; - message.username = object.username ?? ""; - message.password = object.password ?? ""; - message.email = object.email ?? ""; - return message; - }, -}; - -function createBaseSshCredentials(): SshCredentials { - return { privateKey: "", knownHosts: "" }; -} - -export const SshCredentials = { - encode(message: SshCredentials, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.privateKey !== "") { - writer.uint32(10).string(message.privateKey); - } - if (message.knownHosts !== "") { - writer.uint32(18).string(message.knownHosts); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SshCredentials { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSshCredentials(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.privateKey = reader.string(); - break; - case 2: - message.knownHosts = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): SshCredentials { - return { - privateKey: isSet(object.privateKey) ? String(object.privateKey) : "", - knownHosts: isSet(object.knownHosts) ? String(object.knownHosts) : "", - }; - }, - - toJSON(message: SshCredentials): unknown { - const obj: any = {}; - message.privateKey !== undefined && (obj.privateKey = message.privateKey); - message.knownHosts !== undefined && (obj.knownHosts = message.knownHosts); - return obj; - }, - - create, I>>(base?: I): SshCredentials { - return SshCredentials.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): SshCredentials { - const message = createBaseSshCredentials(); - message.privateKey = object.privateKey ?? ""; - message.knownHosts = object.knownHosts ?? ""; - return message; - }, -}; - -function createBaseOpaqueCredentials(): OpaqueCredentials { - return { data: {} }; -} - -export const OpaqueCredentials = { - encode(message: OpaqueCredentials, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - Object.entries(message.data).forEach(([key, value]) => { - OpaqueCredentials_DataEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).ldelim(); - }); - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): OpaqueCredentials { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOpaqueCredentials(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - const entry1 = OpaqueCredentials_DataEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.data[entry1.key] = entry1.value; - } - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): OpaqueCredentials { - return { - data: isObject(object.data) - ? Object.entries(object.data).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: OpaqueCredentials): unknown { - const obj: any = {}; - obj.data = {}; - if (message.data) { - Object.entries(message.data).forEach(([k, v]) => { - obj.data[k] = v; - }); - } - return obj; - }, - - create, I>>(base?: I): OpaqueCredentials { - return OpaqueCredentials.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): OpaqueCredentials { - const message = createBaseOpaqueCredentials(); - message.data = Object.entries(object.data ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseOpaqueCredentials_DataEntry(): OpaqueCredentials_DataEntry { - return { key: "", value: "" }; -} - -export const OpaqueCredentials_DataEntry = { - encode( - message: OpaqueCredentials_DataEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): OpaqueCredentials_DataEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseOpaqueCredentials_DataEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): OpaqueCredentials_DataEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: OpaqueCredentials_DataEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): OpaqueCredentials_DataEntry { - return OpaqueCredentials_DataEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): OpaqueCredentials_DataEntry { - const message = createBaseOpaqueCredentials_DataEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSecretKeyReference(): SecretKeyReference { - return { name: "", key: "" }; -} - -export const SecretKeyReference = { - encode(message: SecretKeyReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.key !== "") { - writer.uint32(18).string(message.key); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SecretKeyReference { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSecretKeyReference(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.key = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): SecretKeyReference { - return { - name: isSet(object.name) ? String(object.name) : "", - key: isSet(object.key) ? String(object.key) : "", - }; - }, - - toJSON(message: SecretKeyReference): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.key !== undefined && (obj.key = message.key); - return obj; - }, - - create, I>>(base?: I): SecretKeyReference { - return SecretKeyReference.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): SecretKeyReference { - const message = createBaseSecretKeyReference(); - message.name = object.name ?? ""; - message.key = object.key ?? ""; - return message; - }, -}; - -function createBaseGetPackageRepositoryDetailRequest(): GetPackageRepositoryDetailRequest { - return { packageRepoRef: undefined }; -} - -export const GetPackageRepositoryDetailRequest = { - encode( - message: GetPackageRepositoryDetailRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPackageRepositoryDetailRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPackageRepositoryDetailRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetPackageRepositoryDetailRequest { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - }; - }, - - toJSON(message: GetPackageRepositoryDetailRequest): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetPackageRepositoryDetailRequest { - return GetPackageRepositoryDetailRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetPackageRepositoryDetailRequest { - const message = createBaseGetPackageRepositoryDetailRequest(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - return message; - }, -}; - -function createBaseGetPackageRepositorySummariesRequest(): GetPackageRepositorySummariesRequest { - return { context: undefined }; -} - -export const GetPackageRepositorySummariesRequest = { - encode( - message: GetPackageRepositorySummariesRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPackageRepositorySummariesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPackageRepositorySummariesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetPackageRepositorySummariesRequest { - return { context: isSet(object.context) ? Context.fromJSON(object.context) : undefined }; - }, - - toJSON(message: GetPackageRepositorySummariesRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetPackageRepositorySummariesRequest { - return GetPackageRepositorySummariesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetPackageRepositorySummariesRequest { - const message = createBaseGetPackageRepositorySummariesRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - return message; - }, -}; - -function createBaseUpdatePackageRepositoryRequest(): UpdatePackageRepositoryRequest { - return { - packageRepoRef: undefined, - url: "", - description: "", - interval: "", - tlsConfig: undefined, - auth: undefined, - customDetail: undefined, - }; -} - -export const UpdatePackageRepositoryRequest = { - encode( - message: UpdatePackageRepositoryRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - if (message.url !== "") { - writer.uint32(18).string(message.url); - } - if (message.description !== "") { - writer.uint32(26).string(message.description); - } - if (message.interval !== "") { - writer.uint32(34).string(message.interval); - } - if (message.tlsConfig !== undefined) { - PackageRepositoryTlsConfig.encode(message.tlsConfig, writer.uint32(42).fork()).ldelim(); - } - if (message.auth !== undefined) { - PackageRepositoryAuth.encode(message.auth, writer.uint32(50).fork()).ldelim(); - } - if (message.customDetail !== undefined) { - Any.encode(message.customDetail, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UpdatePackageRepositoryRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdatePackageRepositoryRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - case 2: - message.url = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.interval = reader.string(); - break; - case 5: - message.tlsConfig = PackageRepositoryTlsConfig.decode(reader, reader.uint32()); - break; - case 6: - message.auth = PackageRepositoryAuth.decode(reader, reader.uint32()); - break; - case 11: - message.customDetail = Any.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): UpdatePackageRepositoryRequest { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - url: isSet(object.url) ? String(object.url) : "", - description: isSet(object.description) ? String(object.description) : "", - interval: isSet(object.interval) ? String(object.interval) : "", - tlsConfig: isSet(object.tlsConfig) - ? PackageRepositoryTlsConfig.fromJSON(object.tlsConfig) - : undefined, - auth: isSet(object.auth) ? PackageRepositoryAuth.fromJSON(object.auth) : undefined, - customDetail: isSet(object.customDetail) ? Any.fromJSON(object.customDetail) : undefined, - }; - }, - - toJSON(message: UpdatePackageRepositoryRequest): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - message.url !== undefined && (obj.url = message.url); - message.description !== undefined && (obj.description = message.description); - message.interval !== undefined && (obj.interval = message.interval); - message.tlsConfig !== undefined && - (obj.tlsConfig = message.tlsConfig - ? PackageRepositoryTlsConfig.toJSON(message.tlsConfig) - : undefined); - message.auth !== undefined && - (obj.auth = message.auth ? PackageRepositoryAuth.toJSON(message.auth) : undefined); - message.customDetail !== undefined && - (obj.customDetail = message.customDetail ? Any.toJSON(message.customDetail) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): UpdatePackageRepositoryRequest { - return UpdatePackageRepositoryRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): UpdatePackageRepositoryRequest { - const message = createBaseUpdatePackageRepositoryRequest(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - message.url = object.url ?? ""; - message.description = object.description ?? ""; - message.interval = object.interval ?? ""; - message.tlsConfig = - object.tlsConfig !== undefined && object.tlsConfig !== null - ? PackageRepositoryTlsConfig.fromPartial(object.tlsConfig) - : undefined; - message.auth = - object.auth !== undefined && object.auth !== null - ? PackageRepositoryAuth.fromPartial(object.auth) - : undefined; - message.customDetail = - object.customDetail !== undefined && object.customDetail !== null - ? Any.fromPartial(object.customDetail) - : undefined; - return message; - }, -}; - -function createBaseDeletePackageRepositoryRequest(): DeletePackageRepositoryRequest { - return { packageRepoRef: undefined }; -} - -export const DeletePackageRepositoryRequest = { - encode( - message: DeletePackageRepositoryRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DeletePackageRepositoryRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeletePackageRepositoryRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): DeletePackageRepositoryRequest { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - }; - }, - - toJSON(message: DeletePackageRepositoryRequest): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): DeletePackageRepositoryRequest { - return DeletePackageRepositoryRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): DeletePackageRepositoryRequest { - const message = createBaseDeletePackageRepositoryRequest(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryReference(): PackageRepositoryReference { - return { context: undefined, identifier: "", plugin: undefined }; -} - -export const PackageRepositoryReference = { - encode( - message: PackageRepositoryReference, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.identifier !== "") { - writer.uint32(18).string(message.identifier); - } - if (message.plugin !== undefined) { - Plugin.encode(message.plugin, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryReference { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryReference(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.identifier = reader.string(); - break; - case 3: - message.plugin = Plugin.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryReference { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - identifier: isSet(object.identifier) ? String(object.identifier) : "", - plugin: isSet(object.plugin) ? Plugin.fromJSON(object.plugin) : undefined, - }; - }, - - toJSON(message: PackageRepositoryReference): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.identifier !== undefined && (obj.identifier = message.identifier); - message.plugin !== undefined && - (obj.plugin = message.plugin ? Plugin.toJSON(message.plugin) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryReference { - return PackageRepositoryReference.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryReference { - const message = createBasePackageRepositoryReference(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.identifier = object.identifier ?? ""; - message.plugin = - object.plugin !== undefined && object.plugin !== null - ? Plugin.fromPartial(object.plugin) - : undefined; - return message; - }, -}; - -function createBaseAddPackageRepositoryResponse(): AddPackageRepositoryResponse { - return { packageRepoRef: undefined }; -} - -export const AddPackageRepositoryResponse = { - encode( - message: AddPackageRepositoryResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AddPackageRepositoryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAddPackageRepositoryResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): AddPackageRepositoryResponse { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - }; - }, - - toJSON(message: AddPackageRepositoryResponse): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): AddPackageRepositoryResponse { - return AddPackageRepositoryResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): AddPackageRepositoryResponse { - const message = createBaseAddPackageRepositoryResponse(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryStatus(): PackageRepositoryStatus { - return { ready: false, reason: 0, userReason: "" }; -} - -export const PackageRepositoryStatus = { - encode(message: PackageRepositoryStatus, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ready === true) { - writer.uint32(8).bool(message.ready); - } - if (message.reason !== 0) { - writer.uint32(16).int32(message.reason); - } - if (message.userReason !== "") { - writer.uint32(26).string(message.userReason); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryStatus { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryStatus(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ready = reader.bool(); - break; - case 2: - message.reason = reader.int32() as any; - break; - case 3: - message.userReason = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryStatus { - return { - ready: isSet(object.ready) ? Boolean(object.ready) : false, - reason: isSet(object.reason) - ? packageRepositoryStatus_StatusReasonFromJSON(object.reason) - : 0, - userReason: isSet(object.userReason) ? String(object.userReason) : "", - }; - }, - - toJSON(message: PackageRepositoryStatus): unknown { - const obj: any = {}; - message.ready !== undefined && (obj.ready = message.ready); - message.reason !== undefined && - (obj.reason = packageRepositoryStatus_StatusReasonToJSON(message.reason)); - message.userReason !== undefined && (obj.userReason = message.userReason); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryStatus { - return PackageRepositoryStatus.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryStatus { - const message = createBasePackageRepositoryStatus(); - message.ready = object.ready ?? false; - message.reason = object.reason ?? 0; - message.userReason = object.userReason ?? ""; - return message; - }, -}; - -function createBasePackageRepositoryDetail(): PackageRepositoryDetail { - return { - packageRepoRef: undefined, - name: "", - description: "", - namespaceScoped: false, - type: "", - url: "", - interval: "", - tlsConfig: undefined, - auth: undefined, - customDetail: undefined, - status: undefined, - }; -} - -export const PackageRepositoryDetail = { - encode(message: PackageRepositoryDetail, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - if (message.description !== "") { - writer.uint32(26).string(message.description); - } - if (message.namespaceScoped === true) { - writer.uint32(32).bool(message.namespaceScoped); - } - if (message.type !== "") { - writer.uint32(42).string(message.type); - } - if (message.url !== "") { - writer.uint32(50).string(message.url); - } - if (message.interval !== "") { - writer.uint32(58).string(message.interval); - } - if (message.tlsConfig !== undefined) { - PackageRepositoryTlsConfig.encode(message.tlsConfig, writer.uint32(66).fork()).ldelim(); - } - if (message.auth !== undefined) { - PackageRepositoryAuth.encode(message.auth, writer.uint32(74).fork()).ldelim(); - } - if (message.customDetail !== undefined) { - Any.encode(message.customDetail, writer.uint32(82).fork()).ldelim(); - } - if (message.status !== undefined) { - PackageRepositoryStatus.encode(message.status, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryDetail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryDetail(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.namespaceScoped = reader.bool(); - break; - case 5: - message.type = reader.string(); - break; - case 6: - message.url = reader.string(); - break; - case 7: - message.interval = reader.string(); - break; - case 8: - message.tlsConfig = PackageRepositoryTlsConfig.decode(reader, reader.uint32()); - break; - case 9: - message.auth = PackageRepositoryAuth.decode(reader, reader.uint32()); - break; - case 10: - message.customDetail = Any.decode(reader, reader.uint32()); - break; - case 11: - message.status = PackageRepositoryStatus.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryDetail { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - namespaceScoped: isSet(object.namespaceScoped) ? Boolean(object.namespaceScoped) : false, - type: isSet(object.type) ? String(object.type) : "", - url: isSet(object.url) ? String(object.url) : "", - interval: isSet(object.interval) ? String(object.interval) : "", - tlsConfig: isSet(object.tlsConfig) - ? PackageRepositoryTlsConfig.fromJSON(object.tlsConfig) - : undefined, - auth: isSet(object.auth) ? PackageRepositoryAuth.fromJSON(object.auth) : undefined, - customDetail: isSet(object.customDetail) ? Any.fromJSON(object.customDetail) : undefined, - status: isSet(object.status) ? PackageRepositoryStatus.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: PackageRepositoryDetail): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.description !== undefined && (obj.description = message.description); - message.namespaceScoped !== undefined && (obj.namespaceScoped = message.namespaceScoped); - message.type !== undefined && (obj.type = message.type); - message.url !== undefined && (obj.url = message.url); - message.interval !== undefined && (obj.interval = message.interval); - message.tlsConfig !== undefined && - (obj.tlsConfig = message.tlsConfig - ? PackageRepositoryTlsConfig.toJSON(message.tlsConfig) - : undefined); - message.auth !== undefined && - (obj.auth = message.auth ? PackageRepositoryAuth.toJSON(message.auth) : undefined); - message.customDetail !== undefined && - (obj.customDetail = message.customDetail ? Any.toJSON(message.customDetail) : undefined); - message.status !== undefined && - (obj.status = message.status ? PackageRepositoryStatus.toJSON(message.status) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryDetail { - return PackageRepositoryDetail.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryDetail { - const message = createBasePackageRepositoryDetail(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - message.name = object.name ?? ""; - message.description = object.description ?? ""; - message.namespaceScoped = object.namespaceScoped ?? false; - message.type = object.type ?? ""; - message.url = object.url ?? ""; - message.interval = object.interval ?? ""; - message.tlsConfig = - object.tlsConfig !== undefined && object.tlsConfig !== null - ? PackageRepositoryTlsConfig.fromPartial(object.tlsConfig) - : undefined; - message.auth = - object.auth !== undefined && object.auth !== null - ? PackageRepositoryAuth.fromPartial(object.auth) - : undefined; - message.customDetail = - object.customDetail !== undefined && object.customDetail !== null - ? Any.fromPartial(object.customDetail) - : undefined; - message.status = - object.status !== undefined && object.status !== null - ? PackageRepositoryStatus.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseGetPackageRepositoryDetailResponse(): GetPackageRepositoryDetailResponse { - return { detail: undefined }; -} - -export const GetPackageRepositoryDetailResponse = { - encode( - message: GetPackageRepositoryDetailResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.detail !== undefined) { - PackageRepositoryDetail.encode(message.detail, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPackageRepositoryDetailResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPackageRepositoryDetailResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.detail = PackageRepositoryDetail.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetPackageRepositoryDetailResponse { - return { - detail: isSet(object.detail) ? PackageRepositoryDetail.fromJSON(object.detail) : undefined, - }; - }, - - toJSON(message: GetPackageRepositoryDetailResponse): unknown { - const obj: any = {}; - message.detail !== undefined && - (obj.detail = message.detail ? PackageRepositoryDetail.toJSON(message.detail) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetPackageRepositoryDetailResponse { - return GetPackageRepositoryDetailResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetPackageRepositoryDetailResponse { - const message = createBaseGetPackageRepositoryDetailResponse(); - message.detail = - object.detail !== undefined && object.detail !== null - ? PackageRepositoryDetail.fromPartial(object.detail) - : undefined; - return message; - }, -}; - -function createBasePackageRepositorySummary(): PackageRepositorySummary { - return { - packageRepoRef: undefined, - name: "", - description: "", - namespaceScoped: false, - type: "", - url: "", - status: undefined, - requiresAuth: false, - }; -} - -export const PackageRepositorySummary = { - encode(message: PackageRepositorySummary, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - if (message.name !== "") { - writer.uint32(18).string(message.name); - } - if (message.description !== "") { - writer.uint32(26).string(message.description); - } - if (message.namespaceScoped === true) { - writer.uint32(32).bool(message.namespaceScoped); - } - if (message.type !== "") { - writer.uint32(42).string(message.type); - } - if (message.url !== "") { - writer.uint32(50).string(message.url); - } - if (message.status !== undefined) { - PackageRepositoryStatus.encode(message.status, writer.uint32(58).fork()).ldelim(); - } - if (message.requiresAuth === true) { - writer.uint32(64).bool(message.requiresAuth); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositorySummary { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositorySummary(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.description = reader.string(); - break; - case 4: - message.namespaceScoped = reader.bool(); - break; - case 5: - message.type = reader.string(); - break; - case 6: - message.url = reader.string(); - break; - case 7: - message.status = PackageRepositoryStatus.decode(reader, reader.uint32()); - break; - case 8: - message.requiresAuth = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositorySummary { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - name: isSet(object.name) ? String(object.name) : "", - description: isSet(object.description) ? String(object.description) : "", - namespaceScoped: isSet(object.namespaceScoped) ? Boolean(object.namespaceScoped) : false, - type: isSet(object.type) ? String(object.type) : "", - url: isSet(object.url) ? String(object.url) : "", - status: isSet(object.status) ? PackageRepositoryStatus.fromJSON(object.status) : undefined, - requiresAuth: isSet(object.requiresAuth) ? Boolean(object.requiresAuth) : false, - }; - }, - - toJSON(message: PackageRepositorySummary): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - message.name !== undefined && (obj.name = message.name); - message.description !== undefined && (obj.description = message.description); - message.namespaceScoped !== undefined && (obj.namespaceScoped = message.namespaceScoped); - message.type !== undefined && (obj.type = message.type); - message.url !== undefined && (obj.url = message.url); - message.status !== undefined && - (obj.status = message.status ? PackageRepositoryStatus.toJSON(message.status) : undefined); - message.requiresAuth !== undefined && (obj.requiresAuth = message.requiresAuth); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositorySummary { - return PackageRepositorySummary.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositorySummary { - const message = createBasePackageRepositorySummary(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - message.name = object.name ?? ""; - message.description = object.description ?? ""; - message.namespaceScoped = object.namespaceScoped ?? false; - message.type = object.type ?? ""; - message.url = object.url ?? ""; - message.status = - object.status !== undefined && object.status !== null - ? PackageRepositoryStatus.fromPartial(object.status) - : undefined; - message.requiresAuth = object.requiresAuth ?? false; - return message; - }, -}; - -function createBaseGetPackageRepositorySummariesResponse(): GetPackageRepositorySummariesResponse { - return { packageRepositorySummaries: [] }; -} - -export const GetPackageRepositorySummariesResponse = { - encode( - message: GetPackageRepositorySummariesResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.packageRepositorySummaries) { - PackageRepositorySummary.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPackageRepositorySummariesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPackageRepositorySummariesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepositorySummaries.push( - PackageRepositorySummary.decode(reader, reader.uint32()), - ); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetPackageRepositorySummariesResponse { - return { - packageRepositorySummaries: Array.isArray(object?.packageRepositorySummaries) - ? object.packageRepositorySummaries.map((e: any) => PackageRepositorySummary.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetPackageRepositorySummariesResponse): unknown { - const obj: any = {}; - if (message.packageRepositorySummaries) { - obj.packageRepositorySummaries = message.packageRepositorySummaries.map(e => - e ? PackageRepositorySummary.toJSON(e) : undefined, - ); - } else { - obj.packageRepositorySummaries = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetPackageRepositorySummariesResponse { - return GetPackageRepositorySummariesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetPackageRepositorySummariesResponse { - const message = createBaseGetPackageRepositorySummariesResponse(); - message.packageRepositorySummaries = - object.packageRepositorySummaries?.map(e => PackageRepositorySummary.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUpdatePackageRepositoryResponse(): UpdatePackageRepositoryResponse { - return { packageRepoRef: undefined }; -} - -export const UpdatePackageRepositoryResponse = { - encode( - message: UpdatePackageRepositoryResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.packageRepoRef !== undefined) { - PackageRepositoryReference.encode(message.packageRepoRef, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): UpdatePackageRepositoryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUpdatePackageRepositoryResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.packageRepoRef = PackageRepositoryReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): UpdatePackageRepositoryResponse { - return { - packageRepoRef: isSet(object.packageRepoRef) - ? PackageRepositoryReference.fromJSON(object.packageRepoRef) - : undefined, - }; - }, - - toJSON(message: UpdatePackageRepositoryResponse): unknown { - const obj: any = {}; - message.packageRepoRef !== undefined && - (obj.packageRepoRef = message.packageRepoRef - ? PackageRepositoryReference.toJSON(message.packageRepoRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): UpdatePackageRepositoryResponse { - return UpdatePackageRepositoryResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): UpdatePackageRepositoryResponse { - const message = createBaseUpdatePackageRepositoryResponse(); - message.packageRepoRef = - object.packageRepoRef !== undefined && object.packageRepoRef !== null - ? PackageRepositoryReference.fromPartial(object.packageRepoRef) - : undefined; - return message; - }, -}; - -function createBaseDeletePackageRepositoryResponse(): DeletePackageRepositoryResponse { - return {}; -} - -export const DeletePackageRepositoryResponse = { - encode(_: DeletePackageRepositoryResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DeletePackageRepositoryResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDeletePackageRepositoryResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): DeletePackageRepositoryResponse { - return {}; - }, - - toJSON(_: DeletePackageRepositoryResponse): unknown { - const obj: any = {}; - return obj; - }, - - create, I>>( - base?: I, - ): DeletePackageRepositoryResponse { - return DeletePackageRepositoryResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - _: I, - ): DeletePackageRepositoryResponse { - const message = createBaseDeletePackageRepositoryResponse(); - return message; - }, -}; - -function createBaseGetPackageRepositoryPermissionsRequest(): GetPackageRepositoryPermissionsRequest { - return { context: undefined }; -} - -export const GetPackageRepositoryPermissionsRequest = { - encode( - message: GetPackageRepositoryPermissionsRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPackageRepositoryPermissionsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPackageRepositoryPermissionsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetPackageRepositoryPermissionsRequest { - return { context: isSet(object.context) ? Context.fromJSON(object.context) : undefined }; - }, - - toJSON(message: GetPackageRepositoryPermissionsRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetPackageRepositoryPermissionsRequest { - return GetPackageRepositoryPermissionsRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetPackageRepositoryPermissionsRequest { - const message = createBaseGetPackageRepositoryPermissionsRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoriesPermissions(): PackageRepositoriesPermissions { - return { plugin: undefined, global: {}, namespace: {} }; -} - -export const PackageRepositoriesPermissions = { - encode( - message: PackageRepositoriesPermissions, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.plugin !== undefined) { - Plugin.encode(message.plugin, writer.uint32(10).fork()).ldelim(); - } - Object.entries(message.global).forEach(([key, value]) => { - PackageRepositoriesPermissions_GlobalEntry.encode( - { key: key as any, value }, - writer.uint32(18).fork(), - ).ldelim(); - }); - Object.entries(message.namespace).forEach(([key, value]) => { - PackageRepositoriesPermissions_NamespaceEntry.encode( - { key: key as any, value }, - writer.uint32(26).fork(), - ).ldelim(); - }); - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoriesPermissions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoriesPermissions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.plugin = Plugin.decode(reader, reader.uint32()); - break; - case 2: - const entry2 = PackageRepositoriesPermissions_GlobalEntry.decode(reader, reader.uint32()); - if (entry2.value !== undefined) { - message.global[entry2.key] = entry2.value; - } - break; - case 3: - const entry3 = PackageRepositoriesPermissions_NamespaceEntry.decode( - reader, - reader.uint32(), - ); - if (entry3.value !== undefined) { - message.namespace[entry3.key] = entry3.value; - } - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoriesPermissions { - return { - plugin: isSet(object.plugin) ? Plugin.fromJSON(object.plugin) : undefined, - global: isObject(object.global) - ? Object.entries(object.global).reduce<{ [key: string]: boolean }>((acc, [key, value]) => { - acc[key] = Boolean(value); - return acc; - }, {}) - : {}, - namespace: isObject(object.namespace) - ? Object.entries(object.namespace).reduce<{ [key: string]: boolean }>( - (acc, [key, value]) => { - acc[key] = Boolean(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: PackageRepositoriesPermissions): unknown { - const obj: any = {}; - message.plugin !== undefined && - (obj.plugin = message.plugin ? Plugin.toJSON(message.plugin) : undefined); - obj.global = {}; - if (message.global) { - Object.entries(message.global).forEach(([k, v]) => { - obj.global[k] = v; - }); - } - obj.namespace = {}; - if (message.namespace) { - Object.entries(message.namespace).forEach(([k, v]) => { - obj.namespace[k] = v; - }); - } - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoriesPermissions { - return PackageRepositoriesPermissions.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoriesPermissions { - const message = createBasePackageRepositoriesPermissions(); - message.plugin = - object.plugin !== undefined && object.plugin !== null - ? Plugin.fromPartial(object.plugin) - : undefined; - message.global = Object.entries(object.global ?? {}).reduce<{ [key: string]: boolean }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = Boolean(value); - } - return acc; - }, - {}, - ); - message.namespace = Object.entries(object.namespace ?? {}).reduce<{ [key: string]: boolean }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = Boolean(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBasePackageRepositoriesPermissions_GlobalEntry(): PackageRepositoriesPermissions_GlobalEntry { - return { key: "", value: false }; -} - -export const PackageRepositoriesPermissions_GlobalEntry = { - encode( - message: PackageRepositoriesPermissions_GlobalEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value === true) { - writer.uint32(16).bool(message.value); - } - return writer; - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): PackageRepositoriesPermissions_GlobalEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoriesPermissions_GlobalEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoriesPermissions_GlobalEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? Boolean(object.value) : false, - }; - }, - - toJSON(message: PackageRepositoriesPermissions_GlobalEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoriesPermissions_GlobalEntry { - return PackageRepositoriesPermissions_GlobalEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoriesPermissions_GlobalEntry { - const message = createBasePackageRepositoriesPermissions_GlobalEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? false; - return message; - }, -}; - -function createBasePackageRepositoriesPermissions_NamespaceEntry(): PackageRepositoriesPermissions_NamespaceEntry { - return { key: "", value: false }; -} - -export const PackageRepositoriesPermissions_NamespaceEntry = { - encode( - message: PackageRepositoriesPermissions_NamespaceEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value === true) { - writer.uint32(16).bool(message.value); - } - return writer; - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): PackageRepositoriesPermissions_NamespaceEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoriesPermissions_NamespaceEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoriesPermissions_NamespaceEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? Boolean(object.value) : false, - }; - }, - - toJSON(message: PackageRepositoriesPermissions_NamespaceEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoriesPermissions_NamespaceEntry { - return PackageRepositoriesPermissions_NamespaceEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoriesPermissions_NamespaceEntry { - const message = createBasePackageRepositoriesPermissions_NamespaceEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? false; - return message; - }, -}; - -function createBaseGetPackageRepositoryPermissionsResponse(): GetPackageRepositoryPermissionsResponse { - return { permissions: [] }; -} - -export const GetPackageRepositoryPermissionsResponse = { - encode( - message: GetPackageRepositoryPermissionsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.permissions) { - PackageRepositoriesPermissions.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPackageRepositoryPermissionsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetPackageRepositoryPermissionsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.permissions.push(PackageRepositoriesPermissions.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetPackageRepositoryPermissionsResponse { - return { - permissions: Array.isArray(object?.permissions) - ? object.permissions.map((e: any) => PackageRepositoriesPermissions.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetPackageRepositoryPermissionsResponse): unknown { - const obj: any = {}; - if (message.permissions) { - obj.permissions = message.permissions.map(e => - e ? PackageRepositoriesPermissions.toJSON(e) : undefined, - ); - } else { - obj.permissions = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetPackageRepositoryPermissionsResponse { - return GetPackageRepositoryPermissionsResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetPackageRepositoryPermissionsResponse { - const message = createBaseGetPackageRepositoryPermissionsResponse(); - message.permissions = - object.permissions?.map(e => PackageRepositoriesPermissions.fromPartial(e)) || []; - return message; - }, -}; - -/** Each repositories v1alpha1 plugin must implement at least the following rpcs: */ -export interface RepositoriesService { - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class RepositoriesServiceClientImpl implements RepositoriesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.AddPackageRepository = this.AddPackageRepository.bind(this); - this.GetPackageRepositoryDetail = this.GetPackageRepositoryDetail.bind(this); - this.GetPackageRepositorySummaries = this.GetPackageRepositorySummaries.bind(this); - this.UpdatePackageRepository = this.UpdatePackageRepository.bind(this); - this.DeletePackageRepository = this.DeletePackageRepository.bind(this); - this.GetPackageRepositoryPermissions = this.GetPackageRepositoryPermissions.bind(this); - } - - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - RepositoriesServiceAddPackageRepositoryDesc, - AddPackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - RepositoriesServiceGetPackageRepositoryDetailDesc, - GetPackageRepositoryDetailRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - RepositoriesServiceGetPackageRepositorySummariesDesc, - GetPackageRepositorySummariesRequest.fromPartial(request), - metadata, - ); - } - - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - RepositoriesServiceUpdatePackageRepositoryDesc, - UpdatePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - RepositoriesServiceDeletePackageRepositoryDesc, - DeletePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - RepositoriesServiceGetPackageRepositoryPermissionsDesc, - GetPackageRepositoryPermissionsRequest.fromPartial(request), - metadata, - ); - } -} - -export const RepositoriesServiceDesc = { - serviceName: "kubeappsapis.core.packages.v1alpha1.RepositoriesService", -}; - -export const RepositoriesServiceAddPackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "AddPackageRepository", - service: RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return AddPackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = AddPackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const RepositoriesServiceGetPackageRepositoryDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetPackageRepositoryDetail", - service: RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const RepositoriesServiceGetPackageRepositorySummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetPackageRepositorySummaries", - service: RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositorySummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositorySummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const RepositoriesServiceUpdatePackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "UpdatePackageRepository", - service: RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdatePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdatePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const RepositoriesServiceDeletePackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "DeletePackageRepository", - service: RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeletePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeletePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const RepositoriesServiceGetPackageRepositoryPermissionsDesc: UnaryMethodDefinitionish = { - methodName: "GetPackageRepositoryPermissions", - service: RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryPermissionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryPermissionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/gen/kubeappsapis/core/plugins/v1alpha1/plugins.ts b/dashboard/src/gen/kubeappsapis/core/plugins/v1alpha1/plugins.ts deleted file mode 100644 index e1c1a9dd911..00000000000 --- a/dashboard/src/gen/kubeappsapis/core/plugins/v1alpha1/plugins.ts +++ /dev/null @@ -1,396 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import _m0 from "protobufjs/minimal"; - -export const protobufPackage = "kubeappsapis.core.plugins.v1alpha1"; - -/** - * GetConfiguredPluginsRequest - * - * Request for GetConfiguredPlugins - */ -export interface GetConfiguredPluginsRequest {} - -/** - * GetConfiguredPluginsResponse - * - * Response for GetConfiguredPlugins - */ -export interface GetConfiguredPluginsResponse { - /** - * Plugins - * - * List of Plugin - */ - plugins: Plugin[]; -} - -/** - * Plugin - * - * A plugin can implement multiple services and multiple versions of a service. - */ -export interface Plugin { - /** - * Plugin name - * - * The name of the plugin, such as `fluxv2.packages` or `kapp_controller.packages`. - */ - name: string; - /** - * Plugin version - * - * The version of the plugin, such as v1alpha1 - */ - version: string; -} - -function createBaseGetConfiguredPluginsRequest(): GetConfiguredPluginsRequest { - return {}; -} - -export const GetConfiguredPluginsRequest = { - encode(_: GetConfiguredPluginsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetConfiguredPluginsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetConfiguredPluginsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): GetConfiguredPluginsRequest { - return {}; - }, - - toJSON(_: GetConfiguredPluginsRequest): unknown { - const obj: any = {}; - return obj; - }, - - create, I>>( - base?: I, - ): GetConfiguredPluginsRequest { - return GetConfiguredPluginsRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - _: I, - ): GetConfiguredPluginsRequest { - const message = createBaseGetConfiguredPluginsRequest(); - return message; - }, -}; - -function createBaseGetConfiguredPluginsResponse(): GetConfiguredPluginsResponse { - return { plugins: [] }; -} - -export const GetConfiguredPluginsResponse = { - encode( - message: GetConfiguredPluginsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.plugins) { - Plugin.encode(v!, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetConfiguredPluginsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetConfiguredPluginsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.plugins.push(Plugin.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetConfiguredPluginsResponse { - return { - plugins: Array.isArray(object?.plugins) - ? object.plugins.map((e: any) => Plugin.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetConfiguredPluginsResponse): unknown { - const obj: any = {}; - if (message.plugins) { - obj.plugins = message.plugins.map(e => (e ? Plugin.toJSON(e) : undefined)); - } else { - obj.plugins = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetConfiguredPluginsResponse { - return GetConfiguredPluginsResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetConfiguredPluginsResponse { - const message = createBaseGetConfiguredPluginsResponse(); - message.plugins = object.plugins?.map(e => Plugin.fromPartial(e)) || []; - return message; - }, -}; - -function createBasePlugin(): Plugin { - return { name: "", version: "" }; -} - -export const Plugin = { - encode(message: Plugin, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.version !== "") { - writer.uint32(18).string(message.version); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Plugin { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePlugin(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.version = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): Plugin { - return { - name: isSet(object.name) ? String(object.name) : "", - version: isSet(object.version) ? String(object.version) : "", - }; - }, - - toJSON(message: Plugin): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.version !== undefined && (obj.version = message.version); - return obj; - }, - - create, I>>(base?: I): Plugin { - return Plugin.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): Plugin { - const message = createBasePlugin(); - message.name = object.name ?? ""; - message.version = object.version ?? ""; - return message; - }, -}; - -export interface PluginsService { - /** GetConfiguredPlugins returns a map of short and longnames for the configured plugins. */ - GetConfiguredPlugins( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class PluginsServiceClientImpl implements PluginsService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.GetConfiguredPlugins = this.GetConfiguredPlugins.bind(this); - } - - GetConfiguredPlugins( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - PluginsServiceGetConfiguredPluginsDesc, - GetConfiguredPluginsRequest.fromPartial(request), - metadata, - ); - } -} - -export const PluginsServiceDesc = { - serviceName: "kubeappsapis.core.plugins.v1alpha1.PluginsService", -}; - -export const PluginsServiceGetConfiguredPluginsDesc: UnaryMethodDefinitionish = { - methodName: "GetConfiguredPlugins", - service: PluginsServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetConfiguredPluginsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetConfiguredPluginsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2.ts b/dashboard/src/gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2.ts deleted file mode 100644 index 71c675d972f..00000000000 --- a/dashboard/src/gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2.ts +++ /dev/null @@ -1,870 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import _m0 from "protobufjs/minimal"; -import { - CreateInstalledPackageRequest, - CreateInstalledPackageResponse, - DeleteInstalledPackageRequest, - DeleteInstalledPackageResponse, - GetAvailablePackageDetailRequest, - GetAvailablePackageDetailResponse, - GetAvailablePackageSummariesRequest, - GetAvailablePackageSummariesResponse, - GetAvailablePackageVersionsRequest, - GetAvailablePackageVersionsResponse, - GetInstalledPackageDetailRequest, - GetInstalledPackageDetailResponse, - GetInstalledPackageResourceRefsRequest, - GetInstalledPackageResourceRefsResponse, - GetInstalledPackageSummariesRequest, - GetInstalledPackageSummariesResponse, - UpdateInstalledPackageRequest, - UpdateInstalledPackageResponse, -} from "../../../../core/packages/v1alpha1/packages"; -import { - AddPackageRepositoryRequest, - AddPackageRepositoryResponse, - DeletePackageRepositoryRequest, - DeletePackageRepositoryResponse, - GetPackageRepositoryDetailRequest, - GetPackageRepositoryDetailResponse, - GetPackageRepositoryPermissionsRequest, - GetPackageRepositoryPermissionsResponse, - GetPackageRepositorySummariesRequest, - GetPackageRepositorySummariesResponse, - UpdatePackageRepositoryRequest, - UpdatePackageRepositoryResponse, -} from "../../../../core/packages/v1alpha1/repositories"; - -export const protobufPackage = "kubeappsapis.plugins.fluxv2.packages.v1alpha1"; - -/** - * Flux PackageRepositoryCustomDetail - * - * Custom details for a Flux Package repository - */ -export interface FluxPackageRepositoryCustomDetail { - /** - * optional field that allows specifying an OIDC provider used for authentication purposes - * Supported options are: - * - generic - * - aws - * - azure - * - gcp - * The provider field is supported only for Helm OCI repositories. The repository type must - * be set to "oci" - * ref https://fluxcd.io/flux/components/source/helmrepositories/#provider - */ - provider: string; -} - -function createBaseFluxPackageRepositoryCustomDetail(): FluxPackageRepositoryCustomDetail { - return { provider: "" }; -} - -export const FluxPackageRepositoryCustomDetail = { - encode( - message: FluxPackageRepositoryCustomDetail, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.provider !== "") { - writer.uint32(10).string(message.provider); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): FluxPackageRepositoryCustomDetail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFluxPackageRepositoryCustomDetail(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.provider = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): FluxPackageRepositoryCustomDetail { - return { provider: isSet(object.provider) ? String(object.provider) : "" }; - }, - - toJSON(message: FluxPackageRepositoryCustomDetail): unknown { - const obj: any = {}; - message.provider !== undefined && (obj.provider = message.provider); - return obj; - }, - - create, I>>( - base?: I, - ): FluxPackageRepositoryCustomDetail { - return FluxPackageRepositoryCustomDetail.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): FluxPackageRepositoryCustomDetail { - const message = createBaseFluxPackageRepositoryCustomDetail(); - message.provider = object.provider ?? ""; - return message; - }, -}; - -export interface FluxV2PackagesService { - /** GetAvailablePackageSummaries returns the available packages managed by the 'fluxv2' plugin */ - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetAvailablePackageDetail returns the package metadata managed by the 'fluxv2' plugin */ - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetAvailablePackageVersions returns the package versions managed by the 'fluxv2' plugin */ - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetInstalledPackageSummaries returns the installed packages managed by the 'fluxv2' plugin */ - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetInstalledPackageDetail returns the requested installed package managed by the 'fluxv2' plugin */ - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** CreateInstalledPackage creates an installed package based on the request. */ - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** UpdateInstalledPackage updates an installed package based on the request. */ - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** DeleteInstalledPackage deletes an installed package based on the request. */ - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** - * GetInstalledPackageResourceRefs returns the references for the Kubernetes - * resources created by an installed package. - */ - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class FluxV2PackagesServiceClientImpl implements FluxV2PackagesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.GetAvailablePackageSummaries = this.GetAvailablePackageSummaries.bind(this); - this.GetAvailablePackageDetail = this.GetAvailablePackageDetail.bind(this); - this.GetAvailablePackageVersions = this.GetAvailablePackageVersions.bind(this); - this.GetInstalledPackageSummaries = this.GetInstalledPackageSummaries.bind(this); - this.GetInstalledPackageDetail = this.GetInstalledPackageDetail.bind(this); - this.CreateInstalledPackage = this.CreateInstalledPackage.bind(this); - this.UpdateInstalledPackage = this.UpdateInstalledPackage.bind(this); - this.DeleteInstalledPackage = this.DeleteInstalledPackage.bind(this); - this.GetInstalledPackageResourceRefs = this.GetInstalledPackageResourceRefs.bind(this); - } - - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceGetAvailablePackageSummariesDesc, - GetAvailablePackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceGetAvailablePackageDetailDesc, - GetAvailablePackageDetailRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceGetAvailablePackageVersionsDesc, - GetAvailablePackageVersionsRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceGetInstalledPackageSummariesDesc, - GetInstalledPackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceGetInstalledPackageDetailDesc, - GetInstalledPackageDetailRequest.fromPartial(request), - metadata, - ); - } - - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceCreateInstalledPackageDesc, - CreateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceUpdateInstalledPackageDesc, - UpdateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceDeleteInstalledPackageDesc, - DeleteInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2PackagesServiceGetInstalledPackageResourceRefsDesc, - GetInstalledPackageResourceRefsRequest.fromPartial(request), - metadata, - ); - } -} - -export const FluxV2PackagesServiceDesc = { - serviceName: "kubeappsapis.plugins.fluxv2.packages.v1alpha1.FluxV2PackagesService", -}; - -export const FluxV2PackagesServiceGetAvailablePackageSummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageSummaries", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceGetAvailablePackageDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageDetail", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceGetAvailablePackageVersionsDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageVersions", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageVersionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageVersionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceGetInstalledPackageSummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageSummaries", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceGetInstalledPackageDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageDetail", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceCreateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "CreateInstalledPackage", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CreateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CreateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceUpdateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "UpdateInstalledPackage", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceDeleteInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "DeleteInstalledPackage", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeleteInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeleteInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2PackagesServiceGetInstalledPackageResourceRefsDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageResourceRefs", - service: FluxV2PackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageResourceRefsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageResourceRefsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export interface FluxV2RepositoriesService { - /** - * AddPackageRepository add an existing package repository to the set of ones already managed by the - * 'fluxv2' plugin - */ - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class FluxV2RepositoriesServiceClientImpl implements FluxV2RepositoriesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.AddPackageRepository = this.AddPackageRepository.bind(this); - this.GetPackageRepositoryDetail = this.GetPackageRepositoryDetail.bind(this); - this.GetPackageRepositorySummaries = this.GetPackageRepositorySummaries.bind(this); - this.UpdatePackageRepository = this.UpdatePackageRepository.bind(this); - this.DeletePackageRepository = this.DeletePackageRepository.bind(this); - this.GetPackageRepositoryPermissions = this.GetPackageRepositoryPermissions.bind(this); - } - - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2RepositoriesServiceAddPackageRepositoryDesc, - AddPackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2RepositoriesServiceGetPackageRepositoryDetailDesc, - GetPackageRepositoryDetailRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2RepositoriesServiceGetPackageRepositorySummariesDesc, - GetPackageRepositorySummariesRequest.fromPartial(request), - metadata, - ); - } - - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2RepositoriesServiceUpdatePackageRepositoryDesc, - UpdatePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2RepositoriesServiceDeletePackageRepositoryDesc, - DeletePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - FluxV2RepositoriesServiceGetPackageRepositoryPermissionsDesc, - GetPackageRepositoryPermissionsRequest.fromPartial(request), - metadata, - ); - } -} - -export const FluxV2RepositoriesServiceDesc = { - serviceName: "kubeappsapis.plugins.fluxv2.packages.v1alpha1.FluxV2RepositoriesService", -}; - -export const FluxV2RepositoriesServiceAddPackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "AddPackageRepository", - service: FluxV2RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return AddPackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = AddPackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2RepositoriesServiceGetPackageRepositoryDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetPackageRepositoryDetail", - service: FluxV2RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2RepositoriesServiceGetPackageRepositorySummariesDesc: UnaryMethodDefinitionish = - { - methodName: "GetPackageRepositorySummaries", - service: FluxV2RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositorySummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositorySummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const FluxV2RepositoriesServiceUpdatePackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "UpdatePackageRepository", - service: FluxV2RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdatePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdatePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2RepositoriesServiceDeletePackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "DeletePackageRepository", - service: FluxV2RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeletePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeletePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const FluxV2RepositoriesServiceGetPackageRepositoryPermissionsDesc: UnaryMethodDefinitionish = - { - methodName: "GetPackageRepositoryPermissions", - service: FluxV2RepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryPermissionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryPermissionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm.ts b/dashboard/src/gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm.ts deleted file mode 100644 index 14057ad53d7..00000000000 --- a/dashboard/src/gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm.ts +++ /dev/null @@ -1,1997 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import Long from "long"; -import _m0 from "protobufjs/minimal"; -import { - CreateInstalledPackageRequest, - CreateInstalledPackageResponse, - DeleteInstalledPackageRequest, - DeleteInstalledPackageResponse, - GetAvailablePackageDetailRequest, - GetAvailablePackageDetailResponse, - GetAvailablePackageSummariesRequest, - GetAvailablePackageSummariesResponse, - GetAvailablePackageVersionsRequest, - GetAvailablePackageVersionsResponse, - GetInstalledPackageDetailRequest, - GetInstalledPackageDetailResponse, - GetInstalledPackageResourceRefsRequest, - GetInstalledPackageResourceRefsResponse, - GetInstalledPackageSummariesRequest, - GetInstalledPackageSummariesResponse, - InstalledPackageReference, - UpdateInstalledPackageRequest, - UpdateInstalledPackageResponse, -} from "../../../../core/packages/v1alpha1/packages"; -import { - AddPackageRepositoryRequest, - AddPackageRepositoryResponse, - DeletePackageRepositoryRequest, - DeletePackageRepositoryResponse, - DockerCredentials, - GetPackageRepositoryDetailRequest, - GetPackageRepositoryDetailResponse, - GetPackageRepositoryPermissionsRequest, - GetPackageRepositoryPermissionsResponse, - GetPackageRepositorySummariesRequest, - GetPackageRepositorySummariesResponse, - UpdatePackageRepositoryRequest, - UpdatePackageRepositoryResponse, -} from "../../../../core/packages/v1alpha1/repositories"; - -export const protobufPackage = "kubeappsapis.plugins.helm.packages.v1alpha1"; - -/** - * InstalledPackageDetailCustomDataHelm - * - * InstalledPackageDetailCustomDataHelm is a message type used for the - * InstalledPackageDetail.CustomDetail field by the helm plugin. - */ -export interface InstalledPackageDetailCustomDataHelm { - /** - * ReleaseRevision - * - * A number identifying the Helm revision - */ - releaseRevision: number; -} - -export interface RollbackInstalledPackageRequest { - /** - * Installed package reference - * - * A reference uniquely identifying the installed package. - */ - installedPackageRef?: InstalledPackageReference; - /** - * ReleaseRevision - * - * A number identifying the Helm revision to which to rollback. - */ - releaseRevision: number; -} - -/** - * RollbackInstalledPackageResponse - * - * Response for RollbackInstalledPackage - */ -export interface RollbackInstalledPackageResponse { - /** - * TODO: add example for API docs - * option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { - * example: '{"installed_package_ref": {}}' - * }; - */ - installedPackageRef?: InstalledPackageReference; -} - -export interface ImagesPullSecret { - /** docker credentials secret reference */ - secretRef?: string | undefined; - /** docker credentials data */ - credentials?: DockerCredentials | undefined; -} - -/** - * HelmPackageRepositoryCustomDetail - * - * Custom details for a Helm repository - */ -export interface HelmPackageRepositoryCustomDetail { - /** docker registry credentials for pull secrets */ - imagesPullSecret?: ImagesPullSecret; - /** list of oci repositories */ - ociRepositories: string[]; - /** filter rule to apply to the repository */ - filterRule?: RepositoryFilterRule; - /** whether to perform validation on the repository */ - performValidation: boolean; - /** the query options for the proxy call */ - proxyOptions?: ProxyOptions; - /** selector which must be true for the pod to fit on a node */ - nodeSelector: { [key: string]: string }; - /** set of Pod's Tolerations */ - tolerations: Toleration[]; - /** defines the security options the container should be run with. */ - securityContext?: PodSecurityContext; -} - -export interface HelmPackageRepositoryCustomDetail_NodeSelectorEntry { - key: string; - value: string; -} - -/** - * RepositoryFilterRule - * - * JQ expression for filtering packages - */ -export interface RepositoryFilterRule { - /** jq string expression */ - jq: string; - /** map of variables */ - variables: { [key: string]: string }; -} - -export interface RepositoryFilterRule_VariablesEntry { - key: string; - value: string; -} - -/** - * ProxyOptions - * - * query options for a proxy call - */ -export interface ProxyOptions { - /** if true, the proxy options will be taken into account */ - enabled: boolean; - /** value for the HTTP_PROXY env variable passed to the Pod */ - httpProxy: string; - /** value for the HTTPS_PROXY env variable passed to the Pod */ - httpsProxy: string; - /** value for the NO_PROXY env variable passed to the Pod */ - noProxy: string; -} - -/** - * Toleration - * - * Extracted from the K8s API to avoid a dependency on the K8s API - * https://github.com/kubernetes/api/blob/master/core/v1/generated.proto - */ -export interface Toleration { - key?: string | undefined; - operator?: string | undefined; - value?: string | undefined; - effect?: string | undefined; - tolerationSeconds?: number | undefined; -} - -/** - * PodSecurityContext - * - * Extracted from the K8s API to avoid a dependency on the K8s API - * https://github.com/kubernetes/api/blob/master/core/v1/generated.proto - */ -export interface PodSecurityContext { - runAsUser?: number | undefined; - runAsGroup?: number | undefined; - runAsNonRoot?: boolean | undefined; - supplementalGroups: number[]; - fSGroup?: number | undefined; -} - -function createBaseInstalledPackageDetailCustomDataHelm(): InstalledPackageDetailCustomDataHelm { - return { releaseRevision: 0 }; -} - -export const InstalledPackageDetailCustomDataHelm = { - encode( - message: InstalledPackageDetailCustomDataHelm, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.releaseRevision !== 0) { - writer.uint32(16).int32(message.releaseRevision); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): InstalledPackageDetailCustomDataHelm { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseInstalledPackageDetailCustomDataHelm(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - message.releaseRevision = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): InstalledPackageDetailCustomDataHelm { - return { releaseRevision: isSet(object.releaseRevision) ? Number(object.releaseRevision) : 0 }; - }, - - toJSON(message: InstalledPackageDetailCustomDataHelm): unknown { - const obj: any = {}; - message.releaseRevision !== undefined && - (obj.releaseRevision = Math.round(message.releaseRevision)); - return obj; - }, - - create, I>>( - base?: I, - ): InstalledPackageDetailCustomDataHelm { - return InstalledPackageDetailCustomDataHelm.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): InstalledPackageDetailCustomDataHelm { - const message = createBaseInstalledPackageDetailCustomDataHelm(); - message.releaseRevision = object.releaseRevision ?? 0; - return message; - }, -}; - -function createBaseRollbackInstalledPackageRequest(): RollbackInstalledPackageRequest { - return { installedPackageRef: undefined, releaseRevision: 0 }; -} - -export const RollbackInstalledPackageRequest = { - encode( - message: RollbackInstalledPackageRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.releaseRevision !== 0) { - writer.uint32(16).int32(message.releaseRevision); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RollbackInstalledPackageRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRollbackInstalledPackageRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.releaseRevision = reader.int32(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): RollbackInstalledPackageRequest { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - releaseRevision: isSet(object.releaseRevision) ? Number(object.releaseRevision) : 0, - }; - }, - - toJSON(message: RollbackInstalledPackageRequest): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - message.releaseRevision !== undefined && - (obj.releaseRevision = Math.round(message.releaseRevision)); - return obj; - }, - - create, I>>( - base?: I, - ): RollbackInstalledPackageRequest { - return RollbackInstalledPackageRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): RollbackInstalledPackageRequest { - const message = createBaseRollbackInstalledPackageRequest(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - message.releaseRevision = object.releaseRevision ?? 0; - return message; - }, -}; - -function createBaseRollbackInstalledPackageResponse(): RollbackInstalledPackageResponse { - return { installedPackageRef: undefined }; -} - -export const RollbackInstalledPackageResponse = { - encode( - message: RollbackInstalledPackageResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RollbackInstalledPackageResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRollbackInstalledPackageResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): RollbackInstalledPackageResponse { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - }; - }, - - toJSON(message: RollbackInstalledPackageResponse): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): RollbackInstalledPackageResponse { - return RollbackInstalledPackageResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): RollbackInstalledPackageResponse { - const message = createBaseRollbackInstalledPackageResponse(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - return message; - }, -}; - -function createBaseImagesPullSecret(): ImagesPullSecret { - return { secretRef: undefined, credentials: undefined }; -} - -export const ImagesPullSecret = { - encode(message: ImagesPullSecret, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.secretRef !== undefined) { - writer.uint32(10).string(message.secretRef); - } - if (message.credentials !== undefined) { - DockerCredentials.encode(message.credentials, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ImagesPullSecret { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseImagesPullSecret(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.secretRef = reader.string(); - break; - case 2: - message.credentials = DockerCredentials.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): ImagesPullSecret { - return { - secretRef: isSet(object.secretRef) ? String(object.secretRef) : undefined, - credentials: isSet(object.credentials) - ? DockerCredentials.fromJSON(object.credentials) - : undefined, - }; - }, - - toJSON(message: ImagesPullSecret): unknown { - const obj: any = {}; - message.secretRef !== undefined && (obj.secretRef = message.secretRef); - message.credentials !== undefined && - (obj.credentials = message.credentials - ? DockerCredentials.toJSON(message.credentials) - : undefined); - return obj; - }, - - create, I>>(base?: I): ImagesPullSecret { - return ImagesPullSecret.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): ImagesPullSecret { - const message = createBaseImagesPullSecret(); - message.secretRef = object.secretRef ?? undefined; - message.credentials = - object.credentials !== undefined && object.credentials !== null - ? DockerCredentials.fromPartial(object.credentials) - : undefined; - return message; - }, -}; - -function createBaseHelmPackageRepositoryCustomDetail(): HelmPackageRepositoryCustomDetail { - return { - imagesPullSecret: undefined, - ociRepositories: [], - filterRule: undefined, - performValidation: false, - proxyOptions: undefined, - nodeSelector: {}, - tolerations: [], - securityContext: undefined, - }; -} - -export const HelmPackageRepositoryCustomDetail = { - encode( - message: HelmPackageRepositoryCustomDetail, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.imagesPullSecret !== undefined) { - ImagesPullSecret.encode(message.imagesPullSecret, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.ociRepositories) { - writer.uint32(18).string(v!); - } - if (message.filterRule !== undefined) { - RepositoryFilterRule.encode(message.filterRule, writer.uint32(26).fork()).ldelim(); - } - if (message.performValidation === true) { - writer.uint32(32).bool(message.performValidation); - } - if (message.proxyOptions !== undefined) { - ProxyOptions.encode(message.proxyOptions, writer.uint32(42).fork()).ldelim(); - } - Object.entries(message.nodeSelector).forEach(([key, value]) => { - HelmPackageRepositoryCustomDetail_NodeSelectorEntry.encode( - { key: key as any, value }, - writer.uint32(50).fork(), - ).ldelim(); - }); - for (const v of message.tolerations) { - Toleration.encode(v!, writer.uint32(58).fork()).ldelim(); - } - if (message.securityContext !== undefined) { - PodSecurityContext.encode(message.securityContext, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): HelmPackageRepositoryCustomDetail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHelmPackageRepositoryCustomDetail(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.imagesPullSecret = ImagesPullSecret.decode(reader, reader.uint32()); - break; - case 2: - message.ociRepositories.push(reader.string()); - break; - case 3: - message.filterRule = RepositoryFilterRule.decode(reader, reader.uint32()); - break; - case 4: - message.performValidation = reader.bool(); - break; - case 5: - message.proxyOptions = ProxyOptions.decode(reader, reader.uint32()); - break; - case 6: - const entry6 = HelmPackageRepositoryCustomDetail_NodeSelectorEntry.decode( - reader, - reader.uint32(), - ); - if (entry6.value !== undefined) { - message.nodeSelector[entry6.key] = entry6.value; - } - break; - case 7: - message.tolerations.push(Toleration.decode(reader, reader.uint32())); - break; - case 8: - message.securityContext = PodSecurityContext.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): HelmPackageRepositoryCustomDetail { - return { - imagesPullSecret: isSet(object.imagesPullSecret) - ? ImagesPullSecret.fromJSON(object.imagesPullSecret) - : undefined, - ociRepositories: Array.isArray(object?.ociRepositories) - ? object.ociRepositories.map((e: any) => String(e)) - : [], - filterRule: isSet(object.filterRule) - ? RepositoryFilterRule.fromJSON(object.filterRule) - : undefined, - performValidation: isSet(object.performValidation) - ? Boolean(object.performValidation) - : false, - proxyOptions: isSet(object.proxyOptions) - ? ProxyOptions.fromJSON(object.proxyOptions) - : undefined, - nodeSelector: isObject(object.nodeSelector) - ? Object.entries(object.nodeSelector).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, - {}, - ) - : {}, - tolerations: Array.isArray(object?.tolerations) - ? object.tolerations.map((e: any) => Toleration.fromJSON(e)) - : [], - securityContext: isSet(object.securityContext) - ? PodSecurityContext.fromJSON(object.securityContext) - : undefined, - }; - }, - - toJSON(message: HelmPackageRepositoryCustomDetail): unknown { - const obj: any = {}; - message.imagesPullSecret !== undefined && - (obj.imagesPullSecret = message.imagesPullSecret - ? ImagesPullSecret.toJSON(message.imagesPullSecret) - : undefined); - if (message.ociRepositories) { - obj.ociRepositories = message.ociRepositories.map(e => e); - } else { - obj.ociRepositories = []; - } - message.filterRule !== undefined && - (obj.filterRule = message.filterRule - ? RepositoryFilterRule.toJSON(message.filterRule) - : undefined); - message.performValidation !== undefined && (obj.performValidation = message.performValidation); - message.proxyOptions !== undefined && - (obj.proxyOptions = message.proxyOptions - ? ProxyOptions.toJSON(message.proxyOptions) - : undefined); - obj.nodeSelector = {}; - if (message.nodeSelector) { - Object.entries(message.nodeSelector).forEach(([k, v]) => { - obj.nodeSelector[k] = v; - }); - } - if (message.tolerations) { - obj.tolerations = message.tolerations.map(e => (e ? Toleration.toJSON(e) : undefined)); - } else { - obj.tolerations = []; - } - message.securityContext !== undefined && - (obj.securityContext = message.securityContext - ? PodSecurityContext.toJSON(message.securityContext) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): HelmPackageRepositoryCustomDetail { - return HelmPackageRepositoryCustomDetail.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): HelmPackageRepositoryCustomDetail { - const message = createBaseHelmPackageRepositoryCustomDetail(); - message.imagesPullSecret = - object.imagesPullSecret !== undefined && object.imagesPullSecret !== null - ? ImagesPullSecret.fromPartial(object.imagesPullSecret) - : undefined; - message.ociRepositories = object.ociRepositories?.map(e => e) || []; - message.filterRule = - object.filterRule !== undefined && object.filterRule !== null - ? RepositoryFilterRule.fromPartial(object.filterRule) - : undefined; - message.performValidation = object.performValidation ?? false; - message.proxyOptions = - object.proxyOptions !== undefined && object.proxyOptions !== null - ? ProxyOptions.fromPartial(object.proxyOptions) - : undefined; - message.nodeSelector = Object.entries(object.nodeSelector ?? {}).reduce<{ - [key: string]: string; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, {}); - message.tolerations = object.tolerations?.map(e => Toleration.fromPartial(e)) || []; - message.securityContext = - object.securityContext !== undefined && object.securityContext !== null - ? PodSecurityContext.fromPartial(object.securityContext) - : undefined; - return message; - }, -}; - -function createBaseHelmPackageRepositoryCustomDetail_NodeSelectorEntry(): HelmPackageRepositoryCustomDetail_NodeSelectorEntry { - return { key: "", value: "" }; -} - -export const HelmPackageRepositoryCustomDetail_NodeSelectorEntry = { - encode( - message: HelmPackageRepositoryCustomDetail_NodeSelectorEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): HelmPackageRepositoryCustomDetail_NodeSelectorEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHelmPackageRepositoryCustomDetail_NodeSelectorEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): HelmPackageRepositoryCustomDetail_NodeSelectorEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: HelmPackageRepositoryCustomDetail_NodeSelectorEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): HelmPackageRepositoryCustomDetail_NodeSelectorEntry { - return HelmPackageRepositoryCustomDetail_NodeSelectorEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): HelmPackageRepositoryCustomDetail_NodeSelectorEntry { - const message = createBaseHelmPackageRepositoryCustomDetail_NodeSelectorEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseRepositoryFilterRule(): RepositoryFilterRule { - return { jq: "", variables: {} }; -} - -export const RepositoryFilterRule = { - encode(message: RepositoryFilterRule, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.jq !== "") { - writer.uint32(10).string(message.jq); - } - Object.entries(message.variables).forEach(([key, value]) => { - RepositoryFilterRule_VariablesEntry.encode( - { key: key as any, value }, - writer.uint32(34).fork(), - ).ldelim(); - }); - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RepositoryFilterRule { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRepositoryFilterRule(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.jq = reader.string(); - break; - case 4: - const entry4 = RepositoryFilterRule_VariablesEntry.decode(reader, reader.uint32()); - if (entry4.value !== undefined) { - message.variables[entry4.key] = entry4.value; - } - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): RepositoryFilterRule { - return { - jq: isSet(object.jq) ? String(object.jq) : "", - variables: isObject(object.variables) - ? Object.entries(object.variables).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: RepositoryFilterRule): unknown { - const obj: any = {}; - message.jq !== undefined && (obj.jq = message.jq); - obj.variables = {}; - if (message.variables) { - Object.entries(message.variables).forEach(([k, v]) => { - obj.variables[k] = v; - }); - } - return obj; - }, - - create, I>>(base?: I): RepositoryFilterRule { - return RepositoryFilterRule.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): RepositoryFilterRule { - const message = createBaseRepositoryFilterRule(); - message.jq = object.jq ?? ""; - message.variables = Object.entries(object.variables ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseRepositoryFilterRule_VariablesEntry(): RepositoryFilterRule_VariablesEntry { - return { key: "", value: "" }; -} - -export const RepositoryFilterRule_VariablesEntry = { - encode( - message: RepositoryFilterRule_VariablesEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): RepositoryFilterRule_VariablesEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRepositoryFilterRule_VariablesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): RepositoryFilterRule_VariablesEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: RepositoryFilterRule_VariablesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): RepositoryFilterRule_VariablesEntry { - return RepositoryFilterRule_VariablesEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): RepositoryFilterRule_VariablesEntry { - const message = createBaseRepositoryFilterRule_VariablesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseProxyOptions(): ProxyOptions { - return { enabled: false, httpProxy: "", httpsProxy: "", noProxy: "" }; -} - -export const ProxyOptions = { - encode(message: ProxyOptions, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.enabled === true) { - writer.uint32(8).bool(message.enabled); - } - if (message.httpProxy !== "") { - writer.uint32(18).string(message.httpProxy); - } - if (message.httpsProxy !== "") { - writer.uint32(26).string(message.httpsProxy); - } - if (message.noProxy !== "") { - writer.uint32(34).string(message.noProxy); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ProxyOptions { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProxyOptions(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.enabled = reader.bool(); - break; - case 2: - message.httpProxy = reader.string(); - break; - case 3: - message.httpsProxy = reader.string(); - break; - case 4: - message.noProxy = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): ProxyOptions { - return { - enabled: isSet(object.enabled) ? Boolean(object.enabled) : false, - httpProxy: isSet(object.httpProxy) ? String(object.httpProxy) : "", - httpsProxy: isSet(object.httpsProxy) ? String(object.httpsProxy) : "", - noProxy: isSet(object.noProxy) ? String(object.noProxy) : "", - }; - }, - - toJSON(message: ProxyOptions): unknown { - const obj: any = {}; - message.enabled !== undefined && (obj.enabled = message.enabled); - message.httpProxy !== undefined && (obj.httpProxy = message.httpProxy); - message.httpsProxy !== undefined && (obj.httpsProxy = message.httpsProxy); - message.noProxy !== undefined && (obj.noProxy = message.noProxy); - return obj; - }, - - create, I>>(base?: I): ProxyOptions { - return ProxyOptions.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): ProxyOptions { - const message = createBaseProxyOptions(); - message.enabled = object.enabled ?? false; - message.httpProxy = object.httpProxy ?? ""; - message.httpsProxy = object.httpsProxy ?? ""; - message.noProxy = object.noProxy ?? ""; - return message; - }, -}; - -function createBaseToleration(): Toleration { - return { - key: undefined, - operator: undefined, - value: undefined, - effect: undefined, - tolerationSeconds: undefined, - }; -} - -export const Toleration = { - encode(message: Toleration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.key !== undefined) { - writer.uint32(10).string(message.key); - } - if (message.operator !== undefined) { - writer.uint32(18).string(message.operator); - } - if (message.value !== undefined) { - writer.uint32(26).string(message.value); - } - if (message.effect !== undefined) { - writer.uint32(34).string(message.effect); - } - if (message.tolerationSeconds !== undefined) { - writer.uint32(40).int64(message.tolerationSeconds); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Toleration { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseToleration(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.operator = reader.string(); - break; - case 3: - message.value = reader.string(); - break; - case 4: - message.effect = reader.string(); - break; - case 5: - message.tolerationSeconds = longToNumber(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): Toleration { - return { - key: isSet(object.key) ? String(object.key) : undefined, - operator: isSet(object.operator) ? String(object.operator) : undefined, - value: isSet(object.value) ? String(object.value) : undefined, - effect: isSet(object.effect) ? String(object.effect) : undefined, - tolerationSeconds: isSet(object.tolerationSeconds) - ? Number(object.tolerationSeconds) - : undefined, - }; - }, - - toJSON(message: Toleration): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.operator !== undefined && (obj.operator = message.operator); - message.value !== undefined && (obj.value = message.value); - message.effect !== undefined && (obj.effect = message.effect); - message.tolerationSeconds !== undefined && - (obj.tolerationSeconds = Math.round(message.tolerationSeconds)); - return obj; - }, - - create, I>>(base?: I): Toleration { - return Toleration.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): Toleration { - const message = createBaseToleration(); - message.key = object.key ?? undefined; - message.operator = object.operator ?? undefined; - message.value = object.value ?? undefined; - message.effect = object.effect ?? undefined; - message.tolerationSeconds = object.tolerationSeconds ?? undefined; - return message; - }, -}; - -function createBasePodSecurityContext(): PodSecurityContext { - return { - runAsUser: undefined, - runAsGroup: undefined, - runAsNonRoot: undefined, - supplementalGroups: [], - fSGroup: undefined, - }; -} - -export const PodSecurityContext = { - encode(message: PodSecurityContext, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.runAsUser !== undefined) { - writer.uint32(8).int64(message.runAsUser); - } - if (message.runAsGroup !== undefined) { - writer.uint32(48).int64(message.runAsGroup); - } - if (message.runAsNonRoot !== undefined) { - writer.uint32(24).bool(message.runAsNonRoot); - } - writer.uint32(34).fork(); - for (const v of message.supplementalGroups) { - writer.int64(v); - } - writer.ldelim(); - if (message.fSGroup !== undefined) { - writer.uint32(40).int64(message.fSGroup); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PodSecurityContext { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePodSecurityContext(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.runAsUser = longToNumber(reader.int64() as Long); - break; - case 6: - message.runAsGroup = longToNumber(reader.int64() as Long); - break; - case 3: - message.runAsNonRoot = reader.bool(); - break; - case 4: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.supplementalGroups.push(longToNumber(reader.int64() as Long)); - } - } else { - message.supplementalGroups.push(longToNumber(reader.int64() as Long)); - } - break; - case 5: - message.fSGroup = longToNumber(reader.int64() as Long); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PodSecurityContext { - return { - runAsUser: isSet(object.runAsUser) ? Number(object.runAsUser) : undefined, - runAsGroup: isSet(object.runAsGroup) ? Number(object.runAsGroup) : undefined, - runAsNonRoot: isSet(object.runAsNonRoot) ? Boolean(object.runAsNonRoot) : undefined, - supplementalGroups: Array.isArray(object?.supplementalGroups) - ? object.supplementalGroups.map((e: any) => Number(e)) - : [], - fSGroup: isSet(object.fSGroup) ? Number(object.fSGroup) : undefined, - }; - }, - - toJSON(message: PodSecurityContext): unknown { - const obj: any = {}; - message.runAsUser !== undefined && (obj.runAsUser = Math.round(message.runAsUser)); - message.runAsGroup !== undefined && (obj.runAsGroup = Math.round(message.runAsGroup)); - message.runAsNonRoot !== undefined && (obj.runAsNonRoot = message.runAsNonRoot); - if (message.supplementalGroups) { - obj.supplementalGroups = message.supplementalGroups.map(e => Math.round(e)); - } else { - obj.supplementalGroups = []; - } - message.fSGroup !== undefined && (obj.fSGroup = Math.round(message.fSGroup)); - return obj; - }, - - create, I>>(base?: I): PodSecurityContext { - return PodSecurityContext.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): PodSecurityContext { - const message = createBasePodSecurityContext(); - message.runAsUser = object.runAsUser ?? undefined; - message.runAsGroup = object.runAsGroup ?? undefined; - message.runAsNonRoot = object.runAsNonRoot ?? undefined; - message.supplementalGroups = object.supplementalGroups?.map(e => e) || []; - message.fSGroup = object.fSGroup ?? undefined; - return message; - }, -}; - -export interface HelmPackagesService { - /** GetAvailablePackageSummaries returns the available packages managed by the 'helm' plugin */ - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetAvailablePackageDetail returns the package details managed by the 'helm' plugin */ - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetAvailablePackageVersions returns the package versions managed by the 'helm' plugin */ - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetInstalledPackageSummaries returns the installed packages managed by the 'helm' plugin */ - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetInstalledPackageDetail returns the requested installed package managed by the 'helm' plugin */ - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** CreateInstalledPackage creates an installed package based on the request. */ - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** UpdateInstalledPackage updates an installed package based on the request. */ - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** DeleteInstalledPackage deletes an installed package based on the request. */ - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** RollbackInstalledPackage updates an installed package based on the request. */ - RollbackInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** - * GetInstalledPackageResourceRefs returns the references for the Kubernetes resources created by - * an installed package. - */ - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class HelmPackagesServiceClientImpl implements HelmPackagesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.GetAvailablePackageSummaries = this.GetAvailablePackageSummaries.bind(this); - this.GetAvailablePackageDetail = this.GetAvailablePackageDetail.bind(this); - this.GetAvailablePackageVersions = this.GetAvailablePackageVersions.bind(this); - this.GetInstalledPackageSummaries = this.GetInstalledPackageSummaries.bind(this); - this.GetInstalledPackageDetail = this.GetInstalledPackageDetail.bind(this); - this.CreateInstalledPackage = this.CreateInstalledPackage.bind(this); - this.UpdateInstalledPackage = this.UpdateInstalledPackage.bind(this); - this.DeleteInstalledPackage = this.DeleteInstalledPackage.bind(this); - this.RollbackInstalledPackage = this.RollbackInstalledPackage.bind(this); - this.GetInstalledPackageResourceRefs = this.GetInstalledPackageResourceRefs.bind(this); - } - - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceGetAvailablePackageSummariesDesc, - GetAvailablePackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceGetAvailablePackageDetailDesc, - GetAvailablePackageDetailRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceGetAvailablePackageVersionsDesc, - GetAvailablePackageVersionsRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceGetInstalledPackageSummariesDesc, - GetInstalledPackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceGetInstalledPackageDetailDesc, - GetInstalledPackageDetailRequest.fromPartial(request), - metadata, - ); - } - - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceCreateInstalledPackageDesc, - CreateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceUpdateInstalledPackageDesc, - UpdateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceDeleteInstalledPackageDesc, - DeleteInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - RollbackInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceRollbackInstalledPackageDesc, - RollbackInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmPackagesServiceGetInstalledPackageResourceRefsDesc, - GetInstalledPackageResourceRefsRequest.fromPartial(request), - metadata, - ); - } -} - -export const HelmPackagesServiceDesc = { - serviceName: "kubeappsapis.plugins.helm.packages.v1alpha1.HelmPackagesService", -}; - -export const HelmPackagesServiceGetAvailablePackageSummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageSummaries", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceGetAvailablePackageDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageDetail", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceGetAvailablePackageVersionsDesc: UnaryMethodDefinitionish = { - methodName: "GetAvailablePackageVersions", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageVersionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageVersionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceGetInstalledPackageSummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageSummaries", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceGetInstalledPackageDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageDetail", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceCreateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "CreateInstalledPackage", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CreateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CreateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceUpdateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "UpdateInstalledPackage", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceDeleteInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "DeleteInstalledPackage", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeleteInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeleteInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceRollbackInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "RollbackInstalledPackage", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return RollbackInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = RollbackInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmPackagesServiceGetInstalledPackageResourceRefsDesc: UnaryMethodDefinitionish = { - methodName: "GetInstalledPackageResourceRefs", - service: HelmPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageResourceRefsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageResourceRefsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export interface HelmRepositoriesService { - /** AddPackageRepository add an existing package repository to the set of ones already managed by the Helm plugin */ - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class HelmRepositoriesServiceClientImpl implements HelmRepositoriesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.AddPackageRepository = this.AddPackageRepository.bind(this); - this.GetPackageRepositoryDetail = this.GetPackageRepositoryDetail.bind(this); - this.GetPackageRepositorySummaries = this.GetPackageRepositorySummaries.bind(this); - this.UpdatePackageRepository = this.UpdatePackageRepository.bind(this); - this.DeletePackageRepository = this.DeletePackageRepository.bind(this); - this.GetPackageRepositoryPermissions = this.GetPackageRepositoryPermissions.bind(this); - } - - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmRepositoriesServiceAddPackageRepositoryDesc, - AddPackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmRepositoriesServiceGetPackageRepositoryDetailDesc, - GetPackageRepositoryDetailRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmRepositoriesServiceGetPackageRepositorySummariesDesc, - GetPackageRepositorySummariesRequest.fromPartial(request), - metadata, - ); - } - - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmRepositoriesServiceUpdatePackageRepositoryDesc, - UpdatePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmRepositoriesServiceDeletePackageRepositoryDesc, - DeletePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - HelmRepositoriesServiceGetPackageRepositoryPermissionsDesc, - GetPackageRepositoryPermissionsRequest.fromPartial(request), - metadata, - ); - } -} - -export const HelmRepositoriesServiceDesc = { - serviceName: "kubeappsapis.plugins.helm.packages.v1alpha1.HelmRepositoriesService", -}; - -export const HelmRepositoriesServiceAddPackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "AddPackageRepository", - service: HelmRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return AddPackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = AddPackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmRepositoriesServiceGetPackageRepositoryDetailDesc: UnaryMethodDefinitionish = { - methodName: "GetPackageRepositoryDetail", - service: HelmRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmRepositoriesServiceGetPackageRepositorySummariesDesc: UnaryMethodDefinitionish = { - methodName: "GetPackageRepositorySummaries", - service: HelmRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositorySummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositorySummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmRepositoriesServiceUpdatePackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "UpdatePackageRepository", - service: HelmRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdatePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdatePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmRepositoriesServiceDeletePackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "DeletePackageRepository", - service: HelmRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeletePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeletePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const HelmRepositoriesServiceGetPackageRepositoryPermissionsDesc: UnaryMethodDefinitionish = - { - methodName: "GetPackageRepositoryPermissions", - service: HelmRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryPermissionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryPermissionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function longToNumber(long: Long): number { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new tsProtoGlobalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - return long.toNumber(); -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any; - _m0.configure(); -} - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller.ts b/dashboard/src/gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller.ts deleted file mode 100644 index 58f252d0ae2..00000000000 --- a/dashboard/src/gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller.ts +++ /dev/null @@ -1,1890 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import _m0 from "protobufjs/minimal"; -import { - CreateInstalledPackageRequest, - CreateInstalledPackageResponse, - DeleteInstalledPackageRequest, - DeleteInstalledPackageResponse, - GetAvailablePackageDetailRequest, - GetAvailablePackageDetailResponse, - GetAvailablePackageSummariesRequest, - GetAvailablePackageSummariesResponse, - GetAvailablePackageVersionsRequest, - GetAvailablePackageVersionsResponse, - GetInstalledPackageDetailRequest, - GetInstalledPackageDetailResponse, - GetInstalledPackageResourceRefsRequest, - GetInstalledPackageResourceRefsResponse, - GetInstalledPackageSummariesRequest, - GetInstalledPackageSummariesResponse, - UpdateInstalledPackageRequest, - UpdateInstalledPackageResponse, -} from "../../../../core/packages/v1alpha1/packages"; -import { - AddPackageRepositoryRequest, - AddPackageRepositoryResponse, - DeletePackageRepositoryRequest, - DeletePackageRepositoryResponse, - GetPackageRepositoryDetailRequest, - GetPackageRepositoryDetailResponse, - GetPackageRepositoryPermissionsRequest, - GetPackageRepositoryPermissionsResponse, - GetPackageRepositorySummariesRequest, - GetPackageRepositorySummariesResponse, - UpdatePackageRepositoryRequest, - UpdatePackageRepositoryResponse, -} from "../../../../core/packages/v1alpha1/repositories"; - -export const protobufPackage = "kubeappsapis.plugins.kapp_controller.packages.v1alpha1"; - -/** - * KappControllerPackageRepositoryCustomDetail - * - * custom fields to support other carvel repository types - * this is mirror from https://github.com/vmware-tanzu/carvel-kapp-controller/blob/develop/pkg/apis/kappctrl/v1alpha1/generated.proto - * todo -> find a way to define those messages by referencing proto files from kapp_controller rather than duplication - */ -export interface KappControllerPackageRepositoryCustomDetail { - fetch?: PackageRepositoryFetch; -} - -export interface PackageRepositoryFetch { - imgpkgBundle?: PackageRepositoryImgpkg; - image?: PackageRepositoryImage; - git?: PackageRepositoryGit; - http?: PackageRepositoryHttp; - inline?: PackageRepositoryInline; -} - -export interface PackageRepositoryImgpkg { - tagSelection?: VersionSelection; -} - -export interface PackageRepositoryImage { - tagSelection?: VersionSelection; - subPath: string; -} - -export interface PackageRepositoryGit { - ref: string; - refSelection?: VersionSelection; - subPath: string; - lfsSkipSmudge: boolean; -} - -export interface PackageRepositoryHttp { - subPath: string; - sha256: string; -} - -export interface PackageRepositoryInline { - paths: { [key: string]: string }; - pathsFrom: PackageRepositoryInline_Source[]; -} - -export interface PackageRepositoryInline_SourceRef { - name: string; - directoryPath: string; -} - -export interface PackageRepositoryInline_Source { - secretRef?: PackageRepositoryInline_SourceRef; - configMapRef?: PackageRepositoryInline_SourceRef; -} - -export interface PackageRepositoryInline_PathsEntry { - key: string; - value: string; -} - -export interface VersionSelection { - semver?: VersionSelectionSemver; -} - -export interface VersionSelectionSemver { - constraints: string; - prereleases?: VersionSelectionSemverPrereleases; -} - -export interface VersionSelectionSemverPrereleases { - identifiers: string[]; -} - -function createBaseKappControllerPackageRepositoryCustomDetail(): KappControllerPackageRepositoryCustomDetail { - return { fetch: undefined }; -} - -export const KappControllerPackageRepositoryCustomDetail = { - encode( - message: KappControllerPackageRepositoryCustomDetail, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.fetch !== undefined) { - PackageRepositoryFetch.encode(message.fetch, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): KappControllerPackageRepositoryCustomDetail { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseKappControllerPackageRepositoryCustomDetail(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.fetch = PackageRepositoryFetch.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): KappControllerPackageRepositoryCustomDetail { - return { - fetch: isSet(object.fetch) ? PackageRepositoryFetch.fromJSON(object.fetch) : undefined, - }; - }, - - toJSON(message: KappControllerPackageRepositoryCustomDetail): unknown { - const obj: any = {}; - message.fetch !== undefined && - (obj.fetch = message.fetch ? PackageRepositoryFetch.toJSON(message.fetch) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): KappControllerPackageRepositoryCustomDetail { - return KappControllerPackageRepositoryCustomDetail.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): KappControllerPackageRepositoryCustomDetail { - const message = createBaseKappControllerPackageRepositoryCustomDetail(); - message.fetch = - object.fetch !== undefined && object.fetch !== null - ? PackageRepositoryFetch.fromPartial(object.fetch) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryFetch(): PackageRepositoryFetch { - return { - imgpkgBundle: undefined, - image: undefined, - git: undefined, - http: undefined, - inline: undefined, - }; -} - -export const PackageRepositoryFetch = { - encode(message: PackageRepositoryFetch, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.imgpkgBundle !== undefined) { - PackageRepositoryImgpkg.encode(message.imgpkgBundle, writer.uint32(10).fork()).ldelim(); - } - if (message.image !== undefined) { - PackageRepositoryImage.encode(message.image, writer.uint32(18).fork()).ldelim(); - } - if (message.git !== undefined) { - PackageRepositoryGit.encode(message.git, writer.uint32(26).fork()).ldelim(); - } - if (message.http !== undefined) { - PackageRepositoryHttp.encode(message.http, writer.uint32(34).fork()).ldelim(); - } - if (message.inline !== undefined) { - PackageRepositoryInline.encode(message.inline, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryFetch { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryFetch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.imgpkgBundle = PackageRepositoryImgpkg.decode(reader, reader.uint32()); - break; - case 2: - message.image = PackageRepositoryImage.decode(reader, reader.uint32()); - break; - case 3: - message.git = PackageRepositoryGit.decode(reader, reader.uint32()); - break; - case 4: - message.http = PackageRepositoryHttp.decode(reader, reader.uint32()); - break; - case 5: - message.inline = PackageRepositoryInline.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryFetch { - return { - imgpkgBundle: isSet(object.imgpkgBundle) - ? PackageRepositoryImgpkg.fromJSON(object.imgpkgBundle) - : undefined, - image: isSet(object.image) ? PackageRepositoryImage.fromJSON(object.image) : undefined, - git: isSet(object.git) ? PackageRepositoryGit.fromJSON(object.git) : undefined, - http: isSet(object.http) ? PackageRepositoryHttp.fromJSON(object.http) : undefined, - inline: isSet(object.inline) ? PackageRepositoryInline.fromJSON(object.inline) : undefined, - }; - }, - - toJSON(message: PackageRepositoryFetch): unknown { - const obj: any = {}; - message.imgpkgBundle !== undefined && - (obj.imgpkgBundle = message.imgpkgBundle - ? PackageRepositoryImgpkg.toJSON(message.imgpkgBundle) - : undefined); - message.image !== undefined && - (obj.image = message.image ? PackageRepositoryImage.toJSON(message.image) : undefined); - message.git !== undefined && - (obj.git = message.git ? PackageRepositoryGit.toJSON(message.git) : undefined); - message.http !== undefined && - (obj.http = message.http ? PackageRepositoryHttp.toJSON(message.http) : undefined); - message.inline !== undefined && - (obj.inline = message.inline ? PackageRepositoryInline.toJSON(message.inline) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryFetch { - return PackageRepositoryFetch.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryFetch { - const message = createBasePackageRepositoryFetch(); - message.imgpkgBundle = - object.imgpkgBundle !== undefined && object.imgpkgBundle !== null - ? PackageRepositoryImgpkg.fromPartial(object.imgpkgBundle) - : undefined; - message.image = - object.image !== undefined && object.image !== null - ? PackageRepositoryImage.fromPartial(object.image) - : undefined; - message.git = - object.git !== undefined && object.git !== null - ? PackageRepositoryGit.fromPartial(object.git) - : undefined; - message.http = - object.http !== undefined && object.http !== null - ? PackageRepositoryHttp.fromPartial(object.http) - : undefined; - message.inline = - object.inline !== undefined && object.inline !== null - ? PackageRepositoryInline.fromPartial(object.inline) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryImgpkg(): PackageRepositoryImgpkg { - return { tagSelection: undefined }; -} - -export const PackageRepositoryImgpkg = { - encode(message: PackageRepositoryImgpkg, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.tagSelection !== undefined) { - VersionSelection.encode(message.tagSelection, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryImgpkg { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryImgpkg(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tagSelection = VersionSelection.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryImgpkg { - return { - tagSelection: isSet(object.tagSelection) - ? VersionSelection.fromJSON(object.tagSelection) - : undefined, - }; - }, - - toJSON(message: PackageRepositoryImgpkg): unknown { - const obj: any = {}; - message.tagSelection !== undefined && - (obj.tagSelection = message.tagSelection - ? VersionSelection.toJSON(message.tagSelection) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryImgpkg { - return PackageRepositoryImgpkg.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryImgpkg { - const message = createBasePackageRepositoryImgpkg(); - message.tagSelection = - object.tagSelection !== undefined && object.tagSelection !== null - ? VersionSelection.fromPartial(object.tagSelection) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryImage(): PackageRepositoryImage { - return { tagSelection: undefined, subPath: "" }; -} - -export const PackageRepositoryImage = { - encode(message: PackageRepositoryImage, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.tagSelection !== undefined) { - VersionSelection.encode(message.tagSelection, writer.uint32(10).fork()).ldelim(); - } - if (message.subPath !== "") { - writer.uint32(18).string(message.subPath); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryImage { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryImage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.tagSelection = VersionSelection.decode(reader, reader.uint32()); - break; - case 2: - message.subPath = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryImage { - return { - tagSelection: isSet(object.tagSelection) - ? VersionSelection.fromJSON(object.tagSelection) - : undefined, - subPath: isSet(object.subPath) ? String(object.subPath) : "", - }; - }, - - toJSON(message: PackageRepositoryImage): unknown { - const obj: any = {}; - message.tagSelection !== undefined && - (obj.tagSelection = message.tagSelection - ? VersionSelection.toJSON(message.tagSelection) - : undefined); - message.subPath !== undefined && (obj.subPath = message.subPath); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryImage { - return PackageRepositoryImage.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryImage { - const message = createBasePackageRepositoryImage(); - message.tagSelection = - object.tagSelection !== undefined && object.tagSelection !== null - ? VersionSelection.fromPartial(object.tagSelection) - : undefined; - message.subPath = object.subPath ?? ""; - return message; - }, -}; - -function createBasePackageRepositoryGit(): PackageRepositoryGit { - return { ref: "", refSelection: undefined, subPath: "", lfsSkipSmudge: false }; -} - -export const PackageRepositoryGit = { - encode(message: PackageRepositoryGit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.ref !== "") { - writer.uint32(10).string(message.ref); - } - if (message.refSelection !== undefined) { - VersionSelection.encode(message.refSelection, writer.uint32(18).fork()).ldelim(); - } - if (message.subPath !== "") { - writer.uint32(26).string(message.subPath); - } - if (message.lfsSkipSmudge === true) { - writer.uint32(32).bool(message.lfsSkipSmudge); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryGit { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryGit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.ref = reader.string(); - break; - case 2: - message.refSelection = VersionSelection.decode(reader, reader.uint32()); - break; - case 3: - message.subPath = reader.string(); - break; - case 4: - message.lfsSkipSmudge = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryGit { - return { - ref: isSet(object.ref) ? String(object.ref) : "", - refSelection: isSet(object.refSelection) - ? VersionSelection.fromJSON(object.refSelection) - : undefined, - subPath: isSet(object.subPath) ? String(object.subPath) : "", - lfsSkipSmudge: isSet(object.lfsSkipSmudge) ? Boolean(object.lfsSkipSmudge) : false, - }; - }, - - toJSON(message: PackageRepositoryGit): unknown { - const obj: any = {}; - message.ref !== undefined && (obj.ref = message.ref); - message.refSelection !== undefined && - (obj.refSelection = message.refSelection - ? VersionSelection.toJSON(message.refSelection) - : undefined); - message.subPath !== undefined && (obj.subPath = message.subPath); - message.lfsSkipSmudge !== undefined && (obj.lfsSkipSmudge = message.lfsSkipSmudge); - return obj; - }, - - create, I>>(base?: I): PackageRepositoryGit { - return PackageRepositoryGit.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryGit { - const message = createBasePackageRepositoryGit(); - message.ref = object.ref ?? ""; - message.refSelection = - object.refSelection !== undefined && object.refSelection !== null - ? VersionSelection.fromPartial(object.refSelection) - : undefined; - message.subPath = object.subPath ?? ""; - message.lfsSkipSmudge = object.lfsSkipSmudge ?? false; - return message; - }, -}; - -function createBasePackageRepositoryHttp(): PackageRepositoryHttp { - return { subPath: "", sha256: "" }; -} - -export const PackageRepositoryHttp = { - encode(message: PackageRepositoryHttp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.subPath !== "") { - writer.uint32(10).string(message.subPath); - } - if (message.sha256 !== "") { - writer.uint32(18).string(message.sha256); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryHttp { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryHttp(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.subPath = reader.string(); - break; - case 2: - message.sha256 = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryHttp { - return { - subPath: isSet(object.subPath) ? String(object.subPath) : "", - sha256: isSet(object.sha256) ? String(object.sha256) : "", - }; - }, - - toJSON(message: PackageRepositoryHttp): unknown { - const obj: any = {}; - message.subPath !== undefined && (obj.subPath = message.subPath); - message.sha256 !== undefined && (obj.sha256 = message.sha256); - return obj; - }, - - create, I>>(base?: I): PackageRepositoryHttp { - return PackageRepositoryHttp.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryHttp { - const message = createBasePackageRepositoryHttp(); - message.subPath = object.subPath ?? ""; - message.sha256 = object.sha256 ?? ""; - return message; - }, -}; - -function createBasePackageRepositoryInline(): PackageRepositoryInline { - return { paths: {}, pathsFrom: [] }; -} - -export const PackageRepositoryInline = { - encode(message: PackageRepositoryInline, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - Object.entries(message.paths).forEach(([key, value]) => { - PackageRepositoryInline_PathsEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).ldelim(); - }); - for (const v of message.pathsFrom) { - PackageRepositoryInline_Source.encode(v!, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryInline { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryInline(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - const entry1 = PackageRepositoryInline_PathsEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.paths[entry1.key] = entry1.value; - } - break; - case 2: - message.pathsFrom.push(PackageRepositoryInline_Source.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryInline { - return { - paths: isObject(object.paths) - ? Object.entries(object.paths).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - pathsFrom: Array.isArray(object?.pathsFrom) - ? object.pathsFrom.map((e: any) => PackageRepositoryInline_Source.fromJSON(e)) - : [], - }; - }, - - toJSON(message: PackageRepositoryInline): unknown { - const obj: any = {}; - obj.paths = {}; - if (message.paths) { - Object.entries(message.paths).forEach(([k, v]) => { - obj.paths[k] = v; - }); - } - if (message.pathsFrom) { - obj.pathsFrom = message.pathsFrom.map(e => - e ? PackageRepositoryInline_Source.toJSON(e) : undefined, - ); - } else { - obj.pathsFrom = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryInline { - return PackageRepositoryInline.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryInline { - const message = createBasePackageRepositoryInline(); - message.paths = Object.entries(object.paths ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.pathsFrom = - object.pathsFrom?.map(e => PackageRepositoryInline_Source.fromPartial(e)) || []; - return message; - }, -}; - -function createBasePackageRepositoryInline_SourceRef(): PackageRepositoryInline_SourceRef { - return { name: "", directoryPath: "" }; -} - -export const PackageRepositoryInline_SourceRef = { - encode( - message: PackageRepositoryInline_SourceRef, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.name !== "") { - writer.uint32(10).string(message.name); - } - if (message.directoryPath !== "") { - writer.uint32(18).string(message.directoryPath); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryInline_SourceRef { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryInline_SourceRef(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.name = reader.string(); - break; - case 2: - message.directoryPath = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryInline_SourceRef { - return { - name: isSet(object.name) ? String(object.name) : "", - directoryPath: isSet(object.directoryPath) ? String(object.directoryPath) : "", - }; - }, - - toJSON(message: PackageRepositoryInline_SourceRef): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.directoryPath !== undefined && (obj.directoryPath = message.directoryPath); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryInline_SourceRef { - return PackageRepositoryInline_SourceRef.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryInline_SourceRef { - const message = createBasePackageRepositoryInline_SourceRef(); - message.name = object.name ?? ""; - message.directoryPath = object.directoryPath ?? ""; - return message; - }, -}; - -function createBasePackageRepositoryInline_Source(): PackageRepositoryInline_Source { - return { secretRef: undefined, configMapRef: undefined }; -} - -export const PackageRepositoryInline_Source = { - encode( - message: PackageRepositoryInline_Source, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.secretRef !== undefined) { - PackageRepositoryInline_SourceRef.encode( - message.secretRef, - writer.uint32(10).fork(), - ).ldelim(); - } - if (message.configMapRef !== undefined) { - PackageRepositoryInline_SourceRef.encode( - message.configMapRef, - writer.uint32(18).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryInline_Source { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryInline_Source(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.secretRef = PackageRepositoryInline_SourceRef.decode(reader, reader.uint32()); - break; - case 2: - message.configMapRef = PackageRepositoryInline_SourceRef.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryInline_Source { - return { - secretRef: isSet(object.secretRef) - ? PackageRepositoryInline_SourceRef.fromJSON(object.secretRef) - : undefined, - configMapRef: isSet(object.configMapRef) - ? PackageRepositoryInline_SourceRef.fromJSON(object.configMapRef) - : undefined, - }; - }, - - toJSON(message: PackageRepositoryInline_Source): unknown { - const obj: any = {}; - message.secretRef !== undefined && - (obj.secretRef = message.secretRef - ? PackageRepositoryInline_SourceRef.toJSON(message.secretRef) - : undefined); - message.configMapRef !== undefined && - (obj.configMapRef = message.configMapRef - ? PackageRepositoryInline_SourceRef.toJSON(message.configMapRef) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryInline_Source { - return PackageRepositoryInline_Source.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryInline_Source { - const message = createBasePackageRepositoryInline_Source(); - message.secretRef = - object.secretRef !== undefined && object.secretRef !== null - ? PackageRepositoryInline_SourceRef.fromPartial(object.secretRef) - : undefined; - message.configMapRef = - object.configMapRef !== undefined && object.configMapRef !== null - ? PackageRepositoryInline_SourceRef.fromPartial(object.configMapRef) - : undefined; - return message; - }, -}; - -function createBasePackageRepositoryInline_PathsEntry(): PackageRepositoryInline_PathsEntry { - return { key: "", value: "" }; -} - -export const PackageRepositoryInline_PathsEntry = { - encode( - message: PackageRepositoryInline_PathsEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PackageRepositoryInline_PathsEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePackageRepositoryInline_PathsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): PackageRepositoryInline_PathsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: PackageRepositoryInline_PathsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): PackageRepositoryInline_PathsEntry { - return PackageRepositoryInline_PathsEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): PackageRepositoryInline_PathsEntry { - const message = createBasePackageRepositoryInline_PathsEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseVersionSelection(): VersionSelection { - return { semver: undefined }; -} - -export const VersionSelection = { - encode(message: VersionSelection, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.semver !== undefined) { - VersionSelectionSemver.encode(message.semver, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VersionSelection { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVersionSelection(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.semver = VersionSelectionSemver.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): VersionSelection { - return { - semver: isSet(object.semver) ? VersionSelectionSemver.fromJSON(object.semver) : undefined, - }; - }, - - toJSON(message: VersionSelection): unknown { - const obj: any = {}; - message.semver !== undefined && - (obj.semver = message.semver ? VersionSelectionSemver.toJSON(message.semver) : undefined); - return obj; - }, - - create, I>>(base?: I): VersionSelection { - return VersionSelection.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): VersionSelection { - const message = createBaseVersionSelection(); - message.semver = - object.semver !== undefined && object.semver !== null - ? VersionSelectionSemver.fromPartial(object.semver) - : undefined; - return message; - }, -}; - -function createBaseVersionSelectionSemver(): VersionSelectionSemver { - return { constraints: "", prereleases: undefined }; -} - -export const VersionSelectionSemver = { - encode(message: VersionSelectionSemver, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.constraints !== "") { - writer.uint32(10).string(message.constraints); - } - if (message.prereleases !== undefined) { - VersionSelectionSemverPrereleases.encode( - message.prereleases, - writer.uint32(18).fork(), - ).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VersionSelectionSemver { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVersionSelectionSemver(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.constraints = reader.string(); - break; - case 2: - message.prereleases = VersionSelectionSemverPrereleases.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): VersionSelectionSemver { - return { - constraints: isSet(object.constraints) ? String(object.constraints) : "", - prereleases: isSet(object.prereleases) - ? VersionSelectionSemverPrereleases.fromJSON(object.prereleases) - : undefined, - }; - }, - - toJSON(message: VersionSelectionSemver): unknown { - const obj: any = {}; - message.constraints !== undefined && (obj.constraints = message.constraints); - message.prereleases !== undefined && - (obj.prereleases = message.prereleases - ? VersionSelectionSemverPrereleases.toJSON(message.prereleases) - : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): VersionSelectionSemver { - return VersionSelectionSemver.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): VersionSelectionSemver { - const message = createBaseVersionSelectionSemver(); - message.constraints = object.constraints ?? ""; - message.prereleases = - object.prereleases !== undefined && object.prereleases !== null - ? VersionSelectionSemverPrereleases.fromPartial(object.prereleases) - : undefined; - return message; - }, -}; - -function createBaseVersionSelectionSemverPrereleases(): VersionSelectionSemverPrereleases { - return { identifiers: [] }; -} - -export const VersionSelectionSemverPrereleases = { - encode( - message: VersionSelectionSemverPrereleases, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.identifiers) { - writer.uint32(10).string(v!); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): VersionSelectionSemverPrereleases { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVersionSelectionSemverPrereleases(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.identifiers.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): VersionSelectionSemverPrereleases { - return { - identifiers: Array.isArray(object?.identifiers) - ? object.identifiers.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: VersionSelectionSemverPrereleases): unknown { - const obj: any = {}; - if (message.identifiers) { - obj.identifiers = message.identifiers.map(e => e); - } else { - obj.identifiers = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): VersionSelectionSemverPrereleases { - return VersionSelectionSemverPrereleases.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): VersionSelectionSemverPrereleases { - const message = createBaseVersionSelectionSemverPrereleases(); - message.identifiers = object.identifiers?.map(e => e) || []; - return message; - }, -}; - -export interface KappControllerPackagesService { - /** GetAvailablePackageSummaries returns the available packages managed by the 'kapp_controller' plugin */ - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetAvailablePackageDetail returns the package details managed by the 'kapp_controller' plugin */ - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetAvailablePackageVersions returns the package versions managed by the 'kapp_controller' plugin */ - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetInstalledPackageSummaries returns the installed packages managed by the 'kapp_controller' plugin */ - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** GetInstalledPackageDetail returns the requested installed package managed by the 'kapp_controller' plugin */ - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** CreateInstalledPackage creates an installed package based on the request. */ - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** UpdateInstalledPackage updates an installed package based on the request. */ - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** DeleteInstalledPackage deletes an installed package based on the request. */ - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - /** - * GetInstalledPackageResourceRefs returns the references for the Kubernetes resources created by - * an installed package. - */ - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class KappControllerPackagesServiceClientImpl implements KappControllerPackagesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.GetAvailablePackageSummaries = this.GetAvailablePackageSummaries.bind(this); - this.GetAvailablePackageDetail = this.GetAvailablePackageDetail.bind(this); - this.GetAvailablePackageVersions = this.GetAvailablePackageVersions.bind(this); - this.GetInstalledPackageSummaries = this.GetInstalledPackageSummaries.bind(this); - this.GetInstalledPackageDetail = this.GetInstalledPackageDetail.bind(this); - this.CreateInstalledPackage = this.CreateInstalledPackage.bind(this); - this.UpdateInstalledPackage = this.UpdateInstalledPackage.bind(this); - this.DeleteInstalledPackage = this.DeleteInstalledPackage.bind(this); - this.GetInstalledPackageResourceRefs = this.GetInstalledPackageResourceRefs.bind(this); - } - - GetAvailablePackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceGetAvailablePackageSummariesDesc, - GetAvailablePackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceGetAvailablePackageDetailDesc, - GetAvailablePackageDetailRequest.fromPartial(request), - metadata, - ); - } - - GetAvailablePackageVersions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceGetAvailablePackageVersionsDesc, - GetAvailablePackageVersionsRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageSummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceGetInstalledPackageSummariesDesc, - GetInstalledPackageSummariesRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceGetInstalledPackageDetailDesc, - GetInstalledPackageDetailRequest.fromPartial(request), - metadata, - ); - } - - CreateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceCreateInstalledPackageDesc, - CreateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - UpdateInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceUpdateInstalledPackageDesc, - UpdateInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - DeleteInstalledPackage( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceDeleteInstalledPackageDesc, - DeleteInstalledPackageRequest.fromPartial(request), - metadata, - ); - } - - GetInstalledPackageResourceRefs( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerPackagesServiceGetInstalledPackageResourceRefsDesc, - GetInstalledPackageResourceRefsRequest.fromPartial(request), - metadata, - ); - } -} - -export const KappControllerPackagesServiceDesc = { - serviceName: - "kubeappsapis.plugins.kapp_controller.packages.v1alpha1.KappControllerPackagesService", -}; - -export const KappControllerPackagesServiceGetAvailablePackageSummariesDesc: UnaryMethodDefinitionish = - { - methodName: "GetAvailablePackageSummaries", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerPackagesServiceGetAvailablePackageDetailDesc: UnaryMethodDefinitionish = - { - methodName: "GetAvailablePackageDetail", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerPackagesServiceGetAvailablePackageVersionsDesc: UnaryMethodDefinitionish = - { - methodName: "GetAvailablePackageVersions", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetAvailablePackageVersionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetAvailablePackageVersionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerPackagesServiceGetInstalledPackageSummariesDesc: UnaryMethodDefinitionish = - { - methodName: "GetInstalledPackageSummaries", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageSummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageSummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerPackagesServiceGetInstalledPackageDetailDesc: UnaryMethodDefinitionish = - { - methodName: "GetInstalledPackageDetail", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerPackagesServiceCreateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "CreateInstalledPackage", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CreateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CreateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const KappControllerPackagesServiceUpdateInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "UpdateInstalledPackage", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdateInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdateInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const KappControllerPackagesServiceDeleteInstalledPackageDesc: UnaryMethodDefinitionish = { - methodName: "DeleteInstalledPackage", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeleteInstalledPackageRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeleteInstalledPackageResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const KappControllerPackagesServiceGetInstalledPackageResourceRefsDesc: UnaryMethodDefinitionish = - { - methodName: "GetInstalledPackageResourceRefs", - service: KappControllerPackagesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetInstalledPackageResourceRefsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetInstalledPackageResourceRefsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export interface KappControllerRepositoriesService { - /** AddPackageRepository add an existing package repository to the set of ones already managed by the 'kapp_controller' plugin */ - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; -} - -export class KappControllerRepositoriesServiceClientImpl - implements KappControllerRepositoriesService -{ - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.AddPackageRepository = this.AddPackageRepository.bind(this); - this.GetPackageRepositoryDetail = this.GetPackageRepositoryDetail.bind(this); - this.GetPackageRepositorySummaries = this.GetPackageRepositorySummaries.bind(this); - this.UpdatePackageRepository = this.UpdatePackageRepository.bind(this); - this.DeletePackageRepository = this.DeletePackageRepository.bind(this); - this.GetPackageRepositoryPermissions = this.GetPackageRepositoryPermissions.bind(this); - } - - AddPackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerRepositoriesServiceAddPackageRepositoryDesc, - AddPackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryDetail( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerRepositoriesServiceGetPackageRepositoryDetailDesc, - GetPackageRepositoryDetailRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositorySummaries( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerRepositoriesServiceGetPackageRepositorySummariesDesc, - GetPackageRepositorySummariesRequest.fromPartial(request), - metadata, - ); - } - - UpdatePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerRepositoriesServiceUpdatePackageRepositoryDesc, - UpdatePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - DeletePackageRepository( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerRepositoriesServiceDeletePackageRepositoryDesc, - DeletePackageRepositoryRequest.fromPartial(request), - metadata, - ); - } - - GetPackageRepositoryPermissions( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - KappControllerRepositoriesServiceGetPackageRepositoryPermissionsDesc, - GetPackageRepositoryPermissionsRequest.fromPartial(request), - metadata, - ); - } -} - -export const KappControllerRepositoriesServiceDesc = { - serviceName: - "kubeappsapis.plugins.kapp_controller.packages.v1alpha1.KappControllerRepositoriesService", -}; - -export const KappControllerRepositoriesServiceAddPackageRepositoryDesc: UnaryMethodDefinitionish = { - methodName: "AddPackageRepository", - service: KappControllerRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return AddPackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = AddPackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const KappControllerRepositoriesServiceGetPackageRepositoryDetailDesc: UnaryMethodDefinitionish = - { - methodName: "GetPackageRepositoryDetail", - service: KappControllerRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryDetailRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryDetailResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerRepositoriesServiceGetPackageRepositorySummariesDesc: UnaryMethodDefinitionish = - { - methodName: "GetPackageRepositorySummaries", - service: KappControllerRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositorySummariesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositorySummariesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerRepositoriesServiceUpdatePackageRepositoryDesc: UnaryMethodDefinitionish = - { - methodName: "UpdatePackageRepository", - service: KappControllerRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return UpdatePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = UpdatePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerRepositoriesServiceDeletePackageRepositoryDesc: UnaryMethodDefinitionish = - { - methodName: "DeletePackageRepository", - service: KappControllerRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return DeletePackageRepositoryRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = DeletePackageRepositoryResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -export const KappControllerRepositoriesServiceGetPackageRepositoryPermissionsDesc: UnaryMethodDefinitionish = - { - methodName: "GetPackageRepositoryPermissions", - service: KappControllerRepositoriesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetPackageRepositoryPermissionsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetPackageRepositoryPermissionsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, - }; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/gen/kubeappsapis/plugins/resources/v1alpha1/resources.ts b/dashboard/src/gen/kubeappsapis/plugins/resources/v1alpha1/resources.ts deleted file mode 100644 index 5a86705fb54..00000000000 --- a/dashboard/src/gen/kubeappsapis/plugins/resources/v1alpha1/resources.ts +++ /dev/null @@ -1,2168 +0,0 @@ -/* eslint-disable */ -import { grpc } from "@improbable-eng/grpc-web"; -import { BrowserHeaders } from "browser-headers"; -import _m0 from "protobufjs/minimal"; -import { Observable } from "rxjs"; -import { share } from "rxjs/operators"; -import { - Context, - InstalledPackageReference, - ResourceRef, -} from "../../../core/packages/v1alpha1/packages"; - -export const protobufPackage = "kubeappsapis.plugins.resources.v1alpha1"; - -/** - * SecretType - * - * The type of secret. Currently Kubeapps itself only deals with OPAQUE - * and docker config json secrets, but we define all so we can correctly - * list the secret names with their types. - * See https://kubernetes.io/docs/concepts/configuration/secret/#secret-types - */ -export enum SecretType { - SECRET_TYPE_OPAQUE_UNSPECIFIED = 0, - SECRET_TYPE_SERVICE_ACCOUNT_TOKEN = 1, - SECRET_TYPE_DOCKER_CONFIG = 2, - SECRET_TYPE_DOCKER_CONFIG_JSON = 3, - SECRET_TYPE_BASIC_AUTH = 4, - SECRET_TYPE_SSH_AUTH = 5, - SECRET_TYPE_TLS = 6, - SECRET_TYPE_BOOTSTRAP_TOKEN = 7, - UNRECOGNIZED = -1, -} - -export function secretTypeFromJSON(object: any): SecretType { - switch (object) { - case 0: - case "SECRET_TYPE_OPAQUE_UNSPECIFIED": - return SecretType.SECRET_TYPE_OPAQUE_UNSPECIFIED; - case 1: - case "SECRET_TYPE_SERVICE_ACCOUNT_TOKEN": - return SecretType.SECRET_TYPE_SERVICE_ACCOUNT_TOKEN; - case 2: - case "SECRET_TYPE_DOCKER_CONFIG": - return SecretType.SECRET_TYPE_DOCKER_CONFIG; - case 3: - case "SECRET_TYPE_DOCKER_CONFIG_JSON": - return SecretType.SECRET_TYPE_DOCKER_CONFIG_JSON; - case 4: - case "SECRET_TYPE_BASIC_AUTH": - return SecretType.SECRET_TYPE_BASIC_AUTH; - case 5: - case "SECRET_TYPE_SSH_AUTH": - return SecretType.SECRET_TYPE_SSH_AUTH; - case 6: - case "SECRET_TYPE_TLS": - return SecretType.SECRET_TYPE_TLS; - case 7: - case "SECRET_TYPE_BOOTSTRAP_TOKEN": - return SecretType.SECRET_TYPE_BOOTSTRAP_TOKEN; - case -1: - case "UNRECOGNIZED": - default: - return SecretType.UNRECOGNIZED; - } -} - -export function secretTypeToJSON(object: SecretType): string { - switch (object) { - case SecretType.SECRET_TYPE_OPAQUE_UNSPECIFIED: - return "SECRET_TYPE_OPAQUE_UNSPECIFIED"; - case SecretType.SECRET_TYPE_SERVICE_ACCOUNT_TOKEN: - return "SECRET_TYPE_SERVICE_ACCOUNT_TOKEN"; - case SecretType.SECRET_TYPE_DOCKER_CONFIG: - return "SECRET_TYPE_DOCKER_CONFIG"; - case SecretType.SECRET_TYPE_DOCKER_CONFIG_JSON: - return "SECRET_TYPE_DOCKER_CONFIG_JSON"; - case SecretType.SECRET_TYPE_BASIC_AUTH: - return "SECRET_TYPE_BASIC_AUTH"; - case SecretType.SECRET_TYPE_SSH_AUTH: - return "SECRET_TYPE_SSH_AUTH"; - case SecretType.SECRET_TYPE_TLS: - return "SECRET_TYPE_TLS"; - case SecretType.SECRET_TYPE_BOOTSTRAP_TOKEN: - return "SECRET_TYPE_BOOTSTRAP_TOKEN"; - case SecretType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** - * GetResourcesRequest - * - * Request for GetResources that specifies the resource references to get or watch. - */ -export interface GetResourcesRequest { - /** - * InstalledPackageRef - * - * The installed package reference for which the resources are being fetched. - */ - installedPackageRef?: InstalledPackageReference; - /** - * ResourceRefs - * - * The references to the resources that are to be fetched or watched. - * If empty, all resources for the installed package are returned when only - * getting the resources. It must be populated to watch resources to avoid - * watching all resources unnecessarily. - */ - resourceRefs: ResourceRef[]; - /** - * Watch - * - * When true, this will cause the stream to remain open with updated - * resources being sent as events are received from the Kubernetes API - * server. - */ - watch: boolean; -} - -export interface GetResourcesResponse { - /** - * ResourceRef - * - * The resource reference for this single resource. - */ - resourceRef?: ResourceRef; - /** - * Manifest - * - * The current manifest of the requested resource. Initially the JSON - * manifest will be returned a json-encoded string, enabling the existing - * Kubeapps UI to replace its current direct api-server getting and watching - * of resources, but we may in the future pull out further structured - * metadata into this message as needed. - */ - manifest: string; -} - -/** - * GetServiceAccountNamesRequest - * - * Request for GetServiceAccountNames - */ -export interface GetServiceAccountNamesRequest { - /** - * Context - * - * The context for which the service account names are being fetched. - */ - context?: Context; -} - -/** - * GetServiceAccountNamesResponse - * - * Response for GetServiceAccountNames - */ -export interface GetServiceAccountNamesResponse { - /** - * ServiceAccountNames - * - * The list of Service Account names. - */ - serviceaccountNames: string[]; -} - -/** - * GetNamespaceNamesRequest - * - * Request for GetNamespaceNames - */ -export interface GetNamespaceNamesRequest { - /** - * Cluster - * - * The context for which the namespace names are being fetched. The service - * will attempt to list namespaces across the cluster, first with the users - * credential, then with a configured service account if available. - */ - cluster: string; -} - -/** - * GetNamespaceNamesResponse - * - * Response for GetNamespaceNames - */ -export interface GetNamespaceNamesResponse { - /** - * NamespaceNames - * - * The list of Namespace names. - */ - namespaceNames: string[]; -} - -/** - * CreateNamespaceRequest - * - * Request for CreateNamespace - */ -export interface CreateNamespaceRequest { - /** - * Context - * - * The context of the namespace being created. - */ - context?: Context; - /** - * Labels - * - * The additional labels added to the namespace at creation time - */ - labels: { [key: string]: string }; -} - -export interface CreateNamespaceRequest_LabelsEntry { - key: string; - value: string; -} - -/** - * CreateNamespaceResponse - * - * Response for CreateNamespace - */ -export interface CreateNamespaceResponse {} - -/** - * CheckNamespaceExistsRequest - * - * Request for CheckNamespaceExists - */ -export interface CheckNamespaceExistsRequest { - /** - * Context - * - * The context of the namespace being checked for existence. - */ - context?: Context; -} - -/** - * CheckNamespaceExistsResponse - * - * Response for CheckNamespaceExists - */ -export interface CheckNamespaceExistsResponse { - exists: boolean; -} - -/** - * CreateSecretRequest - * - * Request for CreateSecret - */ -export interface CreateSecretRequest { - /** - * Context - * - * The context of the secret being created. - */ - context?: Context; - /** - * Type - * - * The type of the secret. Valid values are defined by the Type enumeration. - */ - type: SecretType; - /** - * Name - * - * The name of the secret. - */ - name: string; - /** - * StringData - * - * The map of keys and values. Note that we use StringData here so that - * Kubernetes handles the base64 encoding of the key values for us. - * See https://kubernetes.io/docs/concepts/configuration/secret/#overview-of-secrets - */ - stringData: { [key: string]: string }; -} - -export interface CreateSecretRequest_StringDataEntry { - key: string; - value: string; -} - -/** - * CreateSecretResponse - * - * Response for CreateSecret - */ -export interface CreateSecretResponse {} - -/** - * GetSecretNamesRequest - * - * Request for GetSecretNames - */ -export interface GetSecretNamesRequest { - /** - * Context - * - * The context for which the secret names are being fetched. - */ - context?: Context; -} - -/** - * GetSecretNamesResponse - * - * Response for GetSecretNames - */ -export interface GetSecretNamesResponse { - /** - * SecretNames - * - * The list of Service Account names. - */ - secretNames: { [key: string]: SecretType }; -} - -export interface GetSecretNamesResponse_SecretNamesEntry { - key: string; - value: SecretType; -} - -/** - * CanIRequest - * - * Request for CanI operation - */ -export interface CanIRequest { - /** - * The context (cluster/namespace) for the can-i request - * "" (empty) namespace means "all" - */ - context?: Context; - /** - * Group API Group of the Resource. "*" means all. - * +optional - */ - group: string; - /** - * Resource is one of the existing resource types. "*" means all. - * +optional - */ - resource: string; - /** - * Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. - * +optional - */ - verb: string; -} - -/** - * CanIResponse - * - * Response for CanI operation - */ -export interface CanIResponse { - /** - * allowed - * - * True if operation is allowed - */ - allowed: boolean; -} - -function createBaseGetResourcesRequest(): GetResourcesRequest { - return { installedPackageRef: undefined, resourceRefs: [], watch: false }; -} - -export const GetResourcesRequest = { - encode(message: GetResourcesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.installedPackageRef !== undefined) { - InstalledPackageReference.encode( - message.installedPackageRef, - writer.uint32(10).fork(), - ).ldelim(); - } - for (const v of message.resourceRefs) { - ResourceRef.encode(v!, writer.uint32(18).fork()).ldelim(); - } - if (message.watch === true) { - writer.uint32(24).bool(message.watch); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetResourcesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetResourcesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.installedPackageRef = InstalledPackageReference.decode(reader, reader.uint32()); - break; - case 2: - message.resourceRefs.push(ResourceRef.decode(reader, reader.uint32())); - break; - case 3: - message.watch = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetResourcesRequest { - return { - installedPackageRef: isSet(object.installedPackageRef) - ? InstalledPackageReference.fromJSON(object.installedPackageRef) - : undefined, - resourceRefs: Array.isArray(object?.resourceRefs) - ? object.resourceRefs.map((e: any) => ResourceRef.fromJSON(e)) - : [], - watch: isSet(object.watch) ? Boolean(object.watch) : false, - }; - }, - - toJSON(message: GetResourcesRequest): unknown { - const obj: any = {}; - message.installedPackageRef !== undefined && - (obj.installedPackageRef = message.installedPackageRef - ? InstalledPackageReference.toJSON(message.installedPackageRef) - : undefined); - if (message.resourceRefs) { - obj.resourceRefs = message.resourceRefs.map(e => (e ? ResourceRef.toJSON(e) : undefined)); - } else { - obj.resourceRefs = []; - } - message.watch !== undefined && (obj.watch = message.watch); - return obj; - }, - - create, I>>(base?: I): GetResourcesRequest { - return GetResourcesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetResourcesRequest { - const message = createBaseGetResourcesRequest(); - message.installedPackageRef = - object.installedPackageRef !== undefined && object.installedPackageRef !== null - ? InstalledPackageReference.fromPartial(object.installedPackageRef) - : undefined; - message.resourceRefs = object.resourceRefs?.map(e => ResourceRef.fromPartial(e)) || []; - message.watch = object.watch ?? false; - return message; - }, -}; - -function createBaseGetResourcesResponse(): GetResourcesResponse { - return { resourceRef: undefined, manifest: "" }; -} - -export const GetResourcesResponse = { - encode(message: GetResourcesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.resourceRef !== undefined) { - ResourceRef.encode(message.resourceRef, writer.uint32(10).fork()).ldelim(); - } - if (message.manifest !== "") { - writer.uint32(18).string(message.manifest); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetResourcesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetResourcesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.resourceRef = ResourceRef.decode(reader, reader.uint32()); - break; - case 2: - message.manifest = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetResourcesResponse { - return { - resourceRef: isSet(object.resourceRef) ? ResourceRef.fromJSON(object.resourceRef) : undefined, - manifest: isSet(object.manifest) ? String(object.manifest) : "", - }; - }, - - toJSON(message: GetResourcesResponse): unknown { - const obj: any = {}; - message.resourceRef !== undefined && - (obj.resourceRef = message.resourceRef ? ResourceRef.toJSON(message.resourceRef) : undefined); - message.manifest !== undefined && (obj.manifest = message.manifest); - return obj; - }, - - create, I>>(base?: I): GetResourcesResponse { - return GetResourcesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetResourcesResponse { - const message = createBaseGetResourcesResponse(); - message.resourceRef = - object.resourceRef !== undefined && object.resourceRef !== null - ? ResourceRef.fromPartial(object.resourceRef) - : undefined; - message.manifest = object.manifest ?? ""; - return message; - }, -}; - -function createBaseGetServiceAccountNamesRequest(): GetServiceAccountNamesRequest { - return { context: undefined }; -} - -export const GetServiceAccountNamesRequest = { - encode( - message: GetServiceAccountNamesRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetServiceAccountNamesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetServiceAccountNamesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetServiceAccountNamesRequest { - return { context: isSet(object.context) ? Context.fromJSON(object.context) : undefined }; - }, - - toJSON(message: GetServiceAccountNamesRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): GetServiceAccountNamesRequest { - return GetServiceAccountNamesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetServiceAccountNamesRequest { - const message = createBaseGetServiceAccountNamesRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - return message; - }, -}; - -function createBaseGetServiceAccountNamesResponse(): GetServiceAccountNamesResponse { - return { serviceaccountNames: [] }; -} - -export const GetServiceAccountNamesResponse = { - encode( - message: GetServiceAccountNamesResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.serviceaccountNames) { - writer.uint32(10).string(v!); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetServiceAccountNamesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetServiceAccountNamesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.serviceaccountNames.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetServiceAccountNamesResponse { - return { - serviceaccountNames: Array.isArray(object?.serviceaccountNames) - ? object.serviceaccountNames.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: GetServiceAccountNamesResponse): unknown { - const obj: any = {}; - if (message.serviceaccountNames) { - obj.serviceaccountNames = message.serviceaccountNames.map(e => e); - } else { - obj.serviceaccountNames = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetServiceAccountNamesResponse { - return GetServiceAccountNamesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetServiceAccountNamesResponse { - const message = createBaseGetServiceAccountNamesResponse(); - message.serviceaccountNames = object.serviceaccountNames?.map(e => e) || []; - return message; - }, -}; - -function createBaseGetNamespaceNamesRequest(): GetNamespaceNamesRequest { - return { cluster: "" }; -} - -export const GetNamespaceNamesRequest = { - encode(message: GetNamespaceNamesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.cluster !== "") { - writer.uint32(10).string(message.cluster); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetNamespaceNamesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetNamespaceNamesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.cluster = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetNamespaceNamesRequest { - return { cluster: isSet(object.cluster) ? String(object.cluster) : "" }; - }, - - toJSON(message: GetNamespaceNamesRequest): unknown { - const obj: any = {}; - message.cluster !== undefined && (obj.cluster = message.cluster); - return obj; - }, - - create, I>>( - base?: I, - ): GetNamespaceNamesRequest { - return GetNamespaceNamesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetNamespaceNamesRequest { - const message = createBaseGetNamespaceNamesRequest(); - message.cluster = object.cluster ?? ""; - return message; - }, -}; - -function createBaseGetNamespaceNamesResponse(): GetNamespaceNamesResponse { - return { namespaceNames: [] }; -} - -export const GetNamespaceNamesResponse = { - encode(message: GetNamespaceNamesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.namespaceNames) { - writer.uint32(10).string(v!); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetNamespaceNamesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetNamespaceNamesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.namespaceNames.push(reader.string()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetNamespaceNamesResponse { - return { - namespaceNames: Array.isArray(object?.namespaceNames) - ? object.namespaceNames.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: GetNamespaceNamesResponse): unknown { - const obj: any = {}; - if (message.namespaceNames) { - obj.namespaceNames = message.namespaceNames.map(e => e); - } else { - obj.namespaceNames = []; - } - return obj; - }, - - create, I>>( - base?: I, - ): GetNamespaceNamesResponse { - return GetNamespaceNamesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetNamespaceNamesResponse { - const message = createBaseGetNamespaceNamesResponse(); - message.namespaceNames = object.namespaceNames?.map(e => e) || []; - return message; - }, -}; - -function createBaseCreateNamespaceRequest(): CreateNamespaceRequest { - return { context: undefined, labels: {} }; -} - -export const CreateNamespaceRequest = { - encode(message: CreateNamespaceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - Object.entries(message.labels).forEach(([key, value]) => { - CreateNamespaceRequest_LabelsEntry.encode( - { key: key as any, value }, - writer.uint32(18).fork(), - ).ldelim(); - }); - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateNamespaceRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateNamespaceRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - const entry2 = CreateNamespaceRequest_LabelsEntry.decode(reader, reader.uint32()); - if (entry2.value !== undefined) { - message.labels[entry2.key] = entry2.value; - } - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CreateNamespaceRequest { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - labels: isObject(object.labels) - ? Object.entries(object.labels).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: CreateNamespaceRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - obj.labels = {}; - if (message.labels) { - Object.entries(message.labels).forEach(([k, v]) => { - obj.labels[k] = v; - }); - } - return obj; - }, - - create, I>>( - base?: I, - ): CreateNamespaceRequest { - return CreateNamespaceRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CreateNamespaceRequest { - const message = createBaseCreateNamespaceRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.labels = Object.entries(object.labels ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseCreateNamespaceRequest_LabelsEntry(): CreateNamespaceRequest_LabelsEntry { - return { key: "", value: "" }; -} - -export const CreateNamespaceRequest_LabelsEntry = { - encode( - message: CreateNamespaceRequest_LabelsEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateNamespaceRequest_LabelsEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateNamespaceRequest_LabelsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CreateNamespaceRequest_LabelsEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: CreateNamespaceRequest_LabelsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): CreateNamespaceRequest_LabelsEntry { - return CreateNamespaceRequest_LabelsEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CreateNamespaceRequest_LabelsEntry { - const message = createBaseCreateNamespaceRequest_LabelsEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseCreateNamespaceResponse(): CreateNamespaceResponse { - return {}; -} - -export const CreateNamespaceResponse = { - encode(_: CreateNamespaceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateNamespaceResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateNamespaceResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): CreateNamespaceResponse { - return {}; - }, - - toJSON(_: CreateNamespaceResponse): unknown { - const obj: any = {}; - return obj; - }, - - create, I>>( - base?: I, - ): CreateNamespaceResponse { - return CreateNamespaceResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - _: I, - ): CreateNamespaceResponse { - const message = createBaseCreateNamespaceResponse(); - return message; - }, -}; - -function createBaseCheckNamespaceExistsRequest(): CheckNamespaceExistsRequest { - return { context: undefined }; -} - -export const CheckNamespaceExistsRequest = { - encode( - message: CheckNamespaceExistsRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CheckNamespaceExistsRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCheckNamespaceExistsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CheckNamespaceExistsRequest { - return { context: isSet(object.context) ? Context.fromJSON(object.context) : undefined }; - }, - - toJSON(message: CheckNamespaceExistsRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - return obj; - }, - - create, I>>( - base?: I, - ): CheckNamespaceExistsRequest { - return CheckNamespaceExistsRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CheckNamespaceExistsRequest { - const message = createBaseCheckNamespaceExistsRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - return message; - }, -}; - -function createBaseCheckNamespaceExistsResponse(): CheckNamespaceExistsResponse { - return { exists: false }; -} - -export const CheckNamespaceExistsResponse = { - encode( - message: CheckNamespaceExistsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.exists === true) { - writer.uint32(8).bool(message.exists); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CheckNamespaceExistsResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCheckNamespaceExistsResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.exists = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CheckNamespaceExistsResponse { - return { exists: isSet(object.exists) ? Boolean(object.exists) : false }; - }, - - toJSON(message: CheckNamespaceExistsResponse): unknown { - const obj: any = {}; - message.exists !== undefined && (obj.exists = message.exists); - return obj; - }, - - create, I>>( - base?: I, - ): CheckNamespaceExistsResponse { - return CheckNamespaceExistsResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CheckNamespaceExistsResponse { - const message = createBaseCheckNamespaceExistsResponse(); - message.exists = object.exists ?? false; - return message; - }, -}; - -function createBaseCreateSecretRequest(): CreateSecretRequest { - return { context: undefined, type: 0, name: "", stringData: {} }; -} - -export const CreateSecretRequest = { - encode(message: CreateSecretRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.type !== 0) { - writer.uint32(16).int32(message.type); - } - if (message.name !== "") { - writer.uint32(26).string(message.name); - } - Object.entries(message.stringData).forEach(([key, value]) => { - CreateSecretRequest_StringDataEntry.encode( - { key: key as any, value }, - writer.uint32(34).fork(), - ).ldelim(); - }); - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateSecretRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSecretRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.type = reader.int32() as any; - break; - case 3: - message.name = reader.string(); - break; - case 4: - const entry4 = CreateSecretRequest_StringDataEntry.decode(reader, reader.uint32()); - if (entry4.value !== undefined) { - message.stringData[entry4.key] = entry4.value; - } - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CreateSecretRequest { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - type: isSet(object.type) ? secretTypeFromJSON(object.type) : 0, - name: isSet(object.name) ? String(object.name) : "", - stringData: isObject(object.stringData) - ? Object.entries(object.stringData).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: CreateSecretRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.type !== undefined && (obj.type = secretTypeToJSON(message.type)); - message.name !== undefined && (obj.name = message.name); - obj.stringData = {}; - if (message.stringData) { - Object.entries(message.stringData).forEach(([k, v]) => { - obj.stringData[k] = v; - }); - } - return obj; - }, - - create, I>>(base?: I): CreateSecretRequest { - return CreateSecretRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CreateSecretRequest { - const message = createBaseCreateSecretRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.type = object.type ?? 0; - message.name = object.name ?? ""; - message.stringData = Object.entries(object.stringData ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseCreateSecretRequest_StringDataEntry(): CreateSecretRequest_StringDataEntry { - return { key: "", value: "" }; -} - -export const CreateSecretRequest_StringDataEntry = { - encode( - message: CreateSecretRequest_StringDataEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateSecretRequest_StringDataEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSecretRequest_StringDataEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CreateSecretRequest_StringDataEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - - toJSON(message: CreateSecretRequest_StringDataEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - create, I>>( - base?: I, - ): CreateSecretRequest_StringDataEntry { - return CreateSecretRequest_StringDataEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): CreateSecretRequest_StringDataEntry { - const message = createBaseCreateSecretRequest_StringDataEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseCreateSecretResponse(): CreateSecretResponse { - return {}; -} - -export const CreateSecretResponse = { - encode(_: CreateSecretResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CreateSecretResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCreateSecretResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(_: any): CreateSecretResponse { - return {}; - }, - - toJSON(_: CreateSecretResponse): unknown { - const obj: any = {}; - return obj; - }, - - create, I>>(base?: I): CreateSecretResponse { - return CreateSecretResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>(_: I): CreateSecretResponse { - const message = createBaseCreateSecretResponse(); - return message; - }, -}; - -function createBaseGetSecretNamesRequest(): GetSecretNamesRequest { - return { context: undefined }; -} - -export const GetSecretNamesRequest = { - encode(message: GetSecretNamesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetSecretNamesRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetSecretNamesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetSecretNamesRequest { - return { context: isSet(object.context) ? Context.fromJSON(object.context) : undefined }; - }, - - toJSON(message: GetSecretNamesRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - return obj; - }, - - create, I>>(base?: I): GetSecretNamesRequest { - return GetSecretNamesRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetSecretNamesRequest { - const message = createBaseGetSecretNamesRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - return message; - }, -}; - -function createBaseGetSecretNamesResponse(): GetSecretNamesResponse { - return { secretNames: {} }; -} - -export const GetSecretNamesResponse = { - encode(message: GetSecretNamesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - Object.entries(message.secretNames).forEach(([key, value]) => { - GetSecretNamesResponse_SecretNamesEntry.encode( - { key: key as any, value }, - writer.uint32(10).fork(), - ).ldelim(); - }); - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetSecretNamesResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetSecretNamesResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - const entry1 = GetSecretNamesResponse_SecretNamesEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.secretNames[entry1.key] = entry1.value; - } - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetSecretNamesResponse { - return { - secretNames: isObject(object.secretNames) - ? Object.entries(object.secretNames).reduce<{ [key: string]: SecretType }>( - (acc, [key, value]) => { - acc[key] = secretTypeFromJSON(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: GetSecretNamesResponse): unknown { - const obj: any = {}; - obj.secretNames = {}; - if (message.secretNames) { - Object.entries(message.secretNames).forEach(([k, v]) => { - obj.secretNames[k] = secretTypeToJSON(v); - }); - } - return obj; - }, - - create, I>>( - base?: I, - ): GetSecretNamesResponse { - return GetSecretNamesResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetSecretNamesResponse { - const message = createBaseGetSecretNamesResponse(); - message.secretNames = Object.entries(object.secretNames ?? {}).reduce<{ - [key: string]: SecretType; - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = value as SecretType; - } - return acc; - }, {}); - return message; - }, -}; - -function createBaseGetSecretNamesResponse_SecretNamesEntry(): GetSecretNamesResponse_SecretNamesEntry { - return { key: "", value: 0 }; -} - -export const GetSecretNamesResponse_SecretNamesEntry = { - encode( - message: GetSecretNamesResponse_SecretNamesEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); - } - if (message.value !== 0) { - writer.uint32(16).int32(message.value); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetSecretNamesResponse_SecretNamesEntry { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGetSecretNamesResponse_SecretNamesEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.int32() as any; - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): GetSecretNamesResponse_SecretNamesEntry { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? secretTypeFromJSON(object.value) : 0, - }; - }, - - toJSON(message: GetSecretNamesResponse_SecretNamesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = secretTypeToJSON(message.value)); - return obj; - }, - - create, I>>( - base?: I, - ): GetSecretNamesResponse_SecretNamesEntry { - return GetSecretNamesResponse_SecretNamesEntry.fromPartial(base ?? {}); - }, - - fromPartial, I>>( - object: I, - ): GetSecretNamesResponse_SecretNamesEntry { - const message = createBaseGetSecretNamesResponse_SecretNamesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? 0; - return message; - }, -}; - -function createBaseCanIRequest(): CanIRequest { - return { context: undefined, group: "", resource: "", verb: "" }; -} - -export const CanIRequest = { - encode(message: CanIRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.context !== undefined) { - Context.encode(message.context, writer.uint32(10).fork()).ldelim(); - } - if (message.group !== "") { - writer.uint32(18).string(message.group); - } - if (message.resource !== "") { - writer.uint32(26).string(message.resource); - } - if (message.verb !== "") { - writer.uint32(34).string(message.verb); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CanIRequest { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCanIRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context = Context.decode(reader, reader.uint32()); - break; - case 2: - message.group = reader.string(); - break; - case 3: - message.resource = reader.string(); - break; - case 4: - message.verb = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CanIRequest { - return { - context: isSet(object.context) ? Context.fromJSON(object.context) : undefined, - group: isSet(object.group) ? String(object.group) : "", - resource: isSet(object.resource) ? String(object.resource) : "", - verb: isSet(object.verb) ? String(object.verb) : "", - }; - }, - - toJSON(message: CanIRequest): unknown { - const obj: any = {}; - message.context !== undefined && - (obj.context = message.context ? Context.toJSON(message.context) : undefined); - message.group !== undefined && (obj.group = message.group); - message.resource !== undefined && (obj.resource = message.resource); - message.verb !== undefined && (obj.verb = message.verb); - return obj; - }, - - create, I>>(base?: I): CanIRequest { - return CanIRequest.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): CanIRequest { - const message = createBaseCanIRequest(); - message.context = - object.context !== undefined && object.context !== null - ? Context.fromPartial(object.context) - : undefined; - message.group = object.group ?? ""; - message.resource = object.resource ?? ""; - message.verb = object.verb ?? ""; - return message; - }, -}; - -function createBaseCanIResponse(): CanIResponse { - return { allowed: false }; -} - -export const CanIResponse = { - encode(message: CanIResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.allowed === true) { - writer.uint32(8).bool(message.allowed); - } - return writer; - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): CanIResponse { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCanIResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.allowed = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - - fromJSON(object: any): CanIResponse { - return { allowed: isSet(object.allowed) ? Boolean(object.allowed) : false }; - }, - - toJSON(message: CanIResponse): unknown { - const obj: any = {}; - message.allowed !== undefined && (obj.allowed = message.allowed); - return obj; - }, - - create, I>>(base?: I): CanIResponse { - return CanIResponse.fromPartial(base ?? {}); - }, - - fromPartial, I>>(object: I): CanIResponse { - const message = createBaseCanIResponse(); - message.allowed = object.allowed ?? false; - return message; - }, -}; - -/** - * ResourcesService - * - * The Resources service is a plugin that enables some limited access to Kubernetes - * resources on the cluster, using the user credentials sent with the request. - */ -export interface ResourcesService { - GetResources( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Observable; - GetServiceAccountNames( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetNamespaceNames( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - CreateNamespace( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - CheckNamespaceExists( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - GetSecretNames( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - CreateSecret( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise; - CanI(request: DeepPartial, metadata?: grpc.Metadata): Promise; -} - -export class ResourcesServiceClientImpl implements ResourcesService { - private readonly rpc: Rpc; - - constructor(rpc: Rpc) { - this.rpc = rpc; - this.GetResources = this.GetResources.bind(this); - this.GetServiceAccountNames = this.GetServiceAccountNames.bind(this); - this.GetNamespaceNames = this.GetNamespaceNames.bind(this); - this.CreateNamespace = this.CreateNamespace.bind(this); - this.CheckNamespaceExists = this.CheckNamespaceExists.bind(this); - this.GetSecretNames = this.GetSecretNames.bind(this); - this.CreateSecret = this.CreateSecret.bind(this); - this.CanI = this.CanI.bind(this); - } - - GetResources( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Observable { - return this.rpc.invoke( - ResourcesServiceGetResourcesDesc, - GetResourcesRequest.fromPartial(request), - metadata, - ); - } - - GetServiceAccountNames( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - ResourcesServiceGetServiceAccountNamesDesc, - GetServiceAccountNamesRequest.fromPartial(request), - metadata, - ); - } - - GetNamespaceNames( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - ResourcesServiceGetNamespaceNamesDesc, - GetNamespaceNamesRequest.fromPartial(request), - metadata, - ); - } - - CreateNamespace( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - ResourcesServiceCreateNamespaceDesc, - CreateNamespaceRequest.fromPartial(request), - metadata, - ); - } - - CheckNamespaceExists( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - ResourcesServiceCheckNamespaceExistsDesc, - CheckNamespaceExistsRequest.fromPartial(request), - metadata, - ); - } - - GetSecretNames( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - ResourcesServiceGetSecretNamesDesc, - GetSecretNamesRequest.fromPartial(request), - metadata, - ); - } - - CreateSecret( - request: DeepPartial, - metadata?: grpc.Metadata, - ): Promise { - return this.rpc.unary( - ResourcesServiceCreateSecretDesc, - CreateSecretRequest.fromPartial(request), - metadata, - ); - } - - CanI(request: DeepPartial, metadata?: grpc.Metadata): Promise { - return this.rpc.unary(ResourcesServiceCanIDesc, CanIRequest.fromPartial(request), metadata); - } -} - -export const ResourcesServiceDesc = { - serviceName: "kubeappsapis.plugins.resources.v1alpha1.ResourcesService", -}; - -export const ResourcesServiceGetResourcesDesc: UnaryMethodDefinitionish = { - methodName: "GetResources", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: true, - requestType: { - serializeBinary() { - return GetResourcesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetResourcesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceGetServiceAccountNamesDesc: UnaryMethodDefinitionish = { - methodName: "GetServiceAccountNames", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetServiceAccountNamesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetServiceAccountNamesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceGetNamespaceNamesDesc: UnaryMethodDefinitionish = { - methodName: "GetNamespaceNames", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetNamespaceNamesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetNamespaceNamesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceCreateNamespaceDesc: UnaryMethodDefinitionish = { - methodName: "CreateNamespace", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CreateNamespaceRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CreateNamespaceResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceCheckNamespaceExistsDesc: UnaryMethodDefinitionish = { - methodName: "CheckNamespaceExists", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CheckNamespaceExistsRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CheckNamespaceExistsResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceGetSecretNamesDesc: UnaryMethodDefinitionish = { - methodName: "GetSecretNames", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return GetSecretNamesRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = GetSecretNamesResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceCreateSecretDesc: UnaryMethodDefinitionish = { - methodName: "CreateSecret", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CreateSecretRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CreateSecretResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -export const ResourcesServiceCanIDesc: UnaryMethodDefinitionish = { - methodName: "CanI", - service: ResourcesServiceDesc, - requestStream: false, - responseStream: false, - requestType: { - serializeBinary() { - return CanIRequest.encode(this).finish(); - }, - } as any, - responseType: { - deserializeBinary(data: Uint8Array) { - const value = CanIResponse.decode(data); - return { - ...value, - toObject() { - return value; - }, - }; - }, - } as any, -}; - -interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition { - requestStream: any; - responseStream: any; -} - -type UnaryMethodDefinitionish = UnaryMethodDefinitionishR; - -interface Rpc { - unary( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Promise; - invoke( - methodDesc: T, - request: any, - metadata: grpc.Metadata | undefined, - ): Observable; -} - -export class GrpcWebImpl { - private host: string; - private options: { - transport?: grpc.TransportFactory; - streamingTransport?: grpc.TransportFactory; - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }; - - constructor( - host: string, - options: { - transport?: grpc.TransportFactory; - streamingTransport?: grpc.TransportFactory; - debug?: boolean; - metadata?: grpc.Metadata; - upStreamRetryCodes?: number[]; - }, - ) { - this.host = host; - this.options = options; - } - - unary( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Promise { - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Promise((resolve, reject) => { - grpc.unary(methodDesc, { - request, - host: this.host, - metadata: maybeCombinedMetadata, - transport: this.options.transport, - debug: this.options.debug, - onEnd: function (response) { - if (response.status === grpc.Code.OK) { - resolve(response.message!.toObject()); - } else { - const err = new GrpcWebError( - response.statusMessage, - response.status, - response.trailers, - ); - reject(err); - } - }, - }); - }); - } - - invoke( - methodDesc: T, - _request: any, - metadata: grpc.Metadata | undefined, - ): Observable { - const upStreamCodes = this.options.upStreamRetryCodes || []; - const DEFAULT_TIMEOUT_TIME: number = 3_000; - const request = { ..._request, ...methodDesc.requestType }; - const maybeCombinedMetadata = - metadata && this.options.metadata - ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap }) - : metadata || this.options.metadata; - return new Observable(observer => { - const upStream = () => { - const client = grpc.invoke(methodDesc, { - host: this.host, - request, - transport: this.options.streamingTransport || this.options.transport, - metadata: maybeCombinedMetadata, - debug: this.options.debug, - onMessage: next => observer.next(next), - onEnd: (code: grpc.Code, message: string, trailers: grpc.Metadata) => { - if (code === 0) { - observer.complete(); - } else if (upStreamCodes.includes(code)) { - setTimeout(upStream, DEFAULT_TIMEOUT_TIME); - } else { - const err = new Error(message) as any; - err.code = code; - err.metadata = trailers; - observer.error(err); - } - }, - }); - observer.add(() => client.close()); - }; - upStream(); - }).pipe(share()); - } -} - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin - ? T - : T extends Array - ? Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} - -export class GrpcWebError extends tsProtoGlobalThis.Error { - constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) { - super(message); - } -} diff --git a/dashboard/src/shared/Auth.ts b/dashboard/src/shared/Auth.ts index 50043fa7d62..e9d6ccd7af8 100644 --- a/dashboard/src/shared/Auth.ts +++ b/dashboard/src/shared/Auth.ts @@ -57,7 +57,7 @@ export class Auth { // Trimming the b64 padding character ("=") as it is not accepted by k8s // https://github.com/kubernetes/apiserver/blob/release-1.22/pkg/authentication/request/websocket/protocol.go#L38 "base64url.bearer.authorization.k8s.io." + - Buffer.from(token).toString("base64").replaceAll("=", ""), + Buffer.from(token).toString("base64").replaceAll("=", ""), "binary.k8s.io", ]; } diff --git a/dashboard/src/shared/KubeappsGrpcClient.test.ts b/dashboard/src/shared/KubeappsGrpcClient.test.ts index 861f2224aef..8b899ce573e 100644 --- a/dashboard/src/shared/KubeappsGrpcClient.test.ts +++ b/dashboard/src/shared/KubeappsGrpcClient.test.ts @@ -4,7 +4,6 @@ import { KubeappsGrpcClient } from "./KubeappsGrpcClient"; describe("kubeapps grpc client creation", () => { - it("should create a kubeapps grpc client", async () => { const kubeappsGrpcClient = new KubeappsGrpcClient(); expect(kubeappsGrpcClient).not.toBeNull(); diff --git a/dashboard/src/shared/KubeappsGrpcClient.ts b/dashboard/src/shared/KubeappsGrpcClient.ts index 251967a1797..65d95c47895 100644 --- a/dashboard/src/shared/KubeappsGrpcClient.ts +++ b/dashboard/src/shared/KubeappsGrpcClient.ts @@ -1,22 +1,24 @@ // Copyright 2021-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 import { ServiceType } from "@bufbuild/protobuf"; -import { - createGrpcWebTransport, -} from "@bufbuild/connect-web"; -import { - createPromiseClient, - Interceptor, - PromiseClient, - Transport, -} from "@bufbuild/connect"; +import { createGrpcWebTransport } from "@bufbuild/connect-web"; +import { createPromiseClient, Interceptor, PromiseClient, Transport } from "@bufbuild/connect"; import { PackagesService } from "gen/kubeappsapis/core/packages/v1alpha1/packages_connect"; import { RepositoriesService } from "gen/kubeappsapis/core/packages/v1alpha1/repositories_connect"; import { PluginsService } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_connect"; import { ResourcesService } from "gen/kubeappsapis/plugins/resources/v1alpha1/resources_connect"; -import { HelmPackagesService, HelmRepositoriesService } from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm_connect"; -import { KappControllerPackagesService, KappControllerRepositoriesService } from "gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller_connect"; -import { FluxV2PackagesService, FluxV2RepositoriesService } from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2_connect"; +import { + HelmPackagesService, + HelmRepositoriesService, +} from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm_connect"; +import { + KappControllerPackagesService, + KappControllerRepositoriesService, +} from "gen/kubeappsapis/plugins/kapp_controller/packages/v1alpha1/kapp_controller_connect"; +import { + FluxV2PackagesService, + FluxV2RepositoriesService, +} from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2_connect"; import { Auth } from "./Auth"; import * as URL from "./url"; @@ -26,29 +28,31 @@ export class KubeappsGrpcClient { // Creates a client with a transport, ensuring the transport includes the auth header. constructor(transport?: Transport, token?: string) { - const auth: Interceptor = (next) => async (req) => { + const auth: Interceptor = next => async req => { let t = token ? token : Auth.getAuthToken(); if (t) { req.header.set("Authorization", t); } return await next(req); }; - this.transport = transport ?? createGrpcWebTransport({ - baseUrl: `/${URL.api.kubeappsapis}`, - interceptors: [auth], - }); + this.transport = + transport ?? + createGrpcWebTransport({ + baseUrl: `/${URL.api.kubeappsapis}`, + interceptors: [auth], + }); } // getClientMetadata, if using token authentication, creates grpc metadata // and the token in the 'authorization' field public getClientMetadata(token?: string) { let t = token ? token : Auth.getAuthToken(); - return t ? new Headers({ "Authorization": `Bearer ${t}` }) : undefined; + return t ? new Headers({ Authorization: `Bearer ${t}` }) : undefined; } public getGrpcClient = (service: T): PromiseClient => { return createPromiseClient(service, this.transport); - } + }; // Core APIs public getPackagesServiceClientImpl() { From 0dcc8f0ed2c2ac021ae3472bddea8913cf7327f0 Mon Sep 17 00:00:00 2001 From: Michael Nelson Date: Thu, 2 Mar 2023 17:43:53 +1100 Subject: [PATCH 04/20] More transferring to new lib. Signed-off-by: Michael Nelson --- .../src/actions/installedpackages.test.tsx | 10 +- dashboard/src/actions/installedpackages.ts | 2 +- .../src/components/AppList/AppList.test.tsx | 4 +- .../src/components/AppList/AppListGrid.tsx | 2 +- .../components/AppList/AppListItem.test.tsx | 4 +- .../src/components/AppList/AppListItem.tsx | 2 +- .../components/AppUpgrade/AppUpgrade.test.tsx | 6 +- .../src/components/AppUpgrade/AppUpgrade.tsx | 4 +- .../AccessURLTable/AccessURLTable.test.tsx | 2 +- .../AppView/AccessURLTable/AccessURLTable.tsx | 10 +- .../DeleteButton/DeleteButton.test.tsx | 2 +- .../AppControls/DeleteButton/DeleteButton.tsx | 4 +- .../RollbackButton/RollbackButton.test.tsx | 4 +- .../AppView/AppSecrets/AppSecrets.test.tsx | 2 +- .../AppView/AppSecrets/AppSecrets.tsx | 2 +- .../src/components/AppView/AppView.test.tsx | 4 +- dashboard/src/components/AppView/AppView.tsx | 12 +- .../AppView/PackageInfo/PackageInfo.test.tsx | 9 +- .../AppView/PackageInfo/PackageUpdateInfo.tsx | 6 +- .../ResourceTable/ResourceTable.test.tsx | 2 +- .../AppView/ResourceTable/ResourceTable.tsx | 2 +- .../ResourceTabs/ResourceTabs.test.tsx | 2 +- .../AppView/ResourceTabs/ResourceTabs.tsx | 2 +- .../ApplicationStatus/ApplicationStatus.tsx | 2 +- .../Catalog/AvailablePackageDetailExcerpt.tsx | 2 +- .../src/components/Catalog/Catalog.test.tsx | 6 +- .../src/components/Catalog/CatalogItem.tsx | 2 +- .../components/Catalog/CatalogItems.test.tsx | 4 +- .../src/components/Catalog/CatalogItems.tsx | 14 +- .../Config/PkgRepoList/PkgRepoButton.test.tsx | 2 +- .../Config/PkgRepoList/PkgRepoButton.tsx | 2 +- .../Config/PkgRepoList/PkgRepoControl.tsx | 2 +- .../Config/PkgRepoList/PkgRepoForm.test.tsx | 8 +- .../Config/PkgRepoList/PkgRepoForm.tsx | 329 +++++++++--------- .../Config/PkgRepoList/PkgRepoList.test.tsx | 4 +- .../Config/PkgRepoList/PkgRepoList.tsx | 10 +- .../DeploymentFormBody.test.tsx | 2 +- .../AvailablePackageMaintainers.test.tsx | 48 +-- .../SelectRepoForm/SelectRepoForm.test.tsx | 6 +- .../SelectRepoForm/SelectRepoForm.tsx | 6 +- .../UpgradeForm/UpgradeForm.test.tsx | 4 +- dashboard/src/reducers/installedpackages.ts | 7 +- dashboard/src/reducers/repos.ts | 14 +- dashboard/src/shared/InstalledPackage.ts | 18 +- .../src/shared/PackageRepositoriesService.ts | 42 +-- dashboard/src/shared/ResourceRef.test.ts | 2 +- dashboard/src/shared/utils.test.ts | 126 +++---- dashboard/src/shared/utils.ts | 54 ++- 48 files changed, 404 insertions(+), 411 deletions(-) diff --git a/dashboard/src/actions/installedpackages.test.tsx b/dashboard/src/actions/installedpackages.test.tsx index 66cefb77cd8..46ab6d60719 100644 --- a/dashboard/src/actions/installedpackages.test.tsx +++ b/dashboard/src/actions/installedpackages.test.tsx @@ -11,8 +11,8 @@ import { InstalledPackageSummary, ReconciliationOptions, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { InstalledPackage } from "shared/InstalledPackage"; import { getStore, initialState } from "shared/specs/mountWrapper"; import { IStoreState, PluginNames, UnprocessableEntityError, UpgradeError } from "shared/types"; @@ -55,9 +55,9 @@ describe("fetches installed packages", () => { beforeEach(() => { requestInstalledPackageListMock = jest.fn( () => - ({ - installedPackageSummaries, - } as GetInstalledPackageSummariesResponse), + ({ + installedPackageSummaries, + } as GetInstalledPackageSummariesResponse), ); InstalledPackage.GetInstalledPackageSummaries = requestInstalledPackageListMock; }); diff --git a/dashboard/src/actions/installedpackages.ts b/dashboard/src/actions/installedpackages.ts index 8d6cb0b0629..83902616899 100644 --- a/dashboard/src/actions/installedpackages.ts +++ b/dashboard/src/actions/installedpackages.ts @@ -11,7 +11,7 @@ import { InstalledPackageSummary, ReconciliationOptions, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { ThunkAction } from "redux-thunk"; import PackagesService from "shared/PackagesService"; import { diff --git a/dashboard/src/components/AppList/AppList.test.tsx b/dashboard/src/components/AppList/AppList.test.tsx index bfe4d500bfb..bc4a61853ff 100644 --- a/dashboard/src/components/AppList/AppList.test.tsx +++ b/dashboard/src/components/AppList/AppList.test.tsx @@ -13,8 +13,8 @@ import { InstalledPackageSummary, PackageAppVersion, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import context from "jest-plugin-context"; import qs from "qs"; import React from "react"; diff --git a/dashboard/src/components/AppList/AppListGrid.tsx b/dashboard/src/components/AppList/AppListGrid.tsx index 88d7be92e58..3cdadb13dc2 100644 --- a/dashboard/src/components/AppList/AppListGrid.tsx +++ b/dashboard/src/components/AppList/AppListGrid.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import Row from "components/js/Row"; -import { InstalledPackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { InstalledPackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { Link } from "react-router-dom"; import { IClusterServiceVersion, IResource } from "../../shared/types"; import * as url from "../../shared/url"; diff --git a/dashboard/src/components/AppList/AppListItem.test.tsx b/dashboard/src/components/AppList/AppListItem.test.tsx index 13497163430..e4c7f2f3625 100644 --- a/dashboard/src/components/AppList/AppListItem.test.tsx +++ b/dashboard/src/components/AppList/AppListItem.test.tsx @@ -11,8 +11,8 @@ import { InstalledPackageSummary, PackageAppVersion, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { defaultStore, mountWrapper } from "shared/specs/mountWrapper"; import { app } from "shared/url"; import InfoCard from "../InfoCard/InfoCard"; diff --git a/dashboard/src/components/AppList/AppListItem.tsx b/dashboard/src/components/AppList/AppListItem.tsx index caa2d78b8f5..1ad56a8ae89 100644 --- a/dashboard/src/components/AppList/AppListItem.tsx +++ b/dashboard/src/components/AppList/AppListItem.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import Tooltip from "components/js/Tooltip"; -import { InstalledPackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { InstalledPackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { getAppStatusLabel, getPluginIcon, getPluginName } from "shared/utils"; import placeholder from "icons/placeholder.svg"; import * as url from "../../shared/url"; diff --git a/dashboard/src/components/AppUpgrade/AppUpgrade.test.tsx b/dashboard/src/components/AppUpgrade/AppUpgrade.test.tsx index 768471ae523..106119f5fad 100644 --- a/dashboard/src/components/AppUpgrade/AppUpgrade.test.tsx +++ b/dashboard/src/components/AppUpgrade/AppUpgrade.test.tsx @@ -13,12 +13,12 @@ import { InstalledPackageStatus_StatusReason, PackageAppVersion, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { PackageRepositoryDetail, PackageRepositorySummary, -} from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import * as ReactRedux from "react-redux"; import * as ReactRouter from "react-router"; import { MemoryRouter, Route } from "react-router-dom"; diff --git a/dashboard/src/components/AppUpgrade/AppUpgrade.tsx b/dashboard/src/components/AppUpgrade/AppUpgrade.tsx index 4af6f8fe248..01bcd4cd350 100644 --- a/dashboard/src/components/AppUpgrade/AppUpgrade.tsx +++ b/dashboard/src/components/AppUpgrade/AppUpgrade.tsx @@ -3,8 +3,8 @@ import actions from "actions"; import Alert from "components/js/Alert"; -import { InstalledPackageReference } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +import { InstalledPackageReference } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import * as ReactRouter from "react-router-dom"; diff --git a/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.test.tsx b/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.test.tsx index 231e060710c..b4ff5c50286 100644 --- a/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.test.tsx +++ b/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.test.tsx @@ -4,7 +4,7 @@ import LoadingWrapper from "components/LoadingWrapper/LoadingWrapper"; import context from "jest-plugin-context"; import { keyForResourceRef } from "shared/ResourceRef"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { defaultStore, getStore, mountWrapper } from "shared/specs/mountWrapper"; import { IIngressSpec, IResource, IServiceSpec, IServiceStatus } from "shared/types"; import AccessURLTable from "./AccessURLTable"; diff --git a/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.tsx b/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.tsx index d49828a5ad6..ad17757abd5 100644 --- a/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.tsx +++ b/dashboard/src/components/AppView/AccessURLTable/AccessURLTable.tsx @@ -5,7 +5,7 @@ import Table from "components/js/Table"; import Tooltip from "components/js/Tooltip"; import { get } from "lodash"; import { useSelector } from "react-redux"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { IK8sList, IKubeItem, IResource, IServiceSpec, IStoreState } from "shared/types"; import LoadingWrapper from "../../../components/LoadingWrapper/LoadingWrapper"; import isSomeResourceLoading from "../helpers"; @@ -173,10 +173,10 @@ export default function AccessURLTable({ ingressRefs, serviceRefs }: IAccessURLT return { url: ingress.item ? GetURLItemFromIngress(ingress.item).URLs.map( - // check whether each URL is, indeed, a valid URL. - // If so, render the , othersiwe, render a simple - url => (ShouldGenerateLink(url) ? getAnchor(url) : getSpan(url)), - ) + // check whether each URL is, indeed, a valid URL. + // If so, render the , othersiwe, render a simple + url => (ShouldGenerateLink(url) ? getAnchor(url) : getSpan(url)), + ) : [getUnknown(index.toString())], // render a simple span with "unknown" type: "Ingress", notes: ingress.error ? ( diff --git a/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.test.tsx b/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.test.tsx index 776500dca89..cf80b09a0ee 100644 --- a/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.test.tsx +++ b/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.test.tsx @@ -9,7 +9,7 @@ import { InstalledPackageReference, InstalledPackageStatus, InstalledPackageStatus_StatusReason, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { act } from "react-dom/test-utils"; import * as ReactRedux from "react-redux"; import { Tooltip as ReactTooltip } from "react-tooltip"; diff --git a/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.tsx b/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.tsx index bb90be79369..7477ed2cea6 100644 --- a/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.tsx +++ b/dashboard/src/components/AppView/AppControls/DeleteButton/DeleteButton.tsx @@ -9,7 +9,7 @@ import { InstalledPackageReference, InstalledPackageStatus, InstalledPackageStatus_StatusReason, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Action } from "redux"; @@ -62,7 +62,7 @@ export default function DeleteButton({ releaseStatus={releaseStatus} id="delete-button" disabled={disabled} - statusesToDeactivate={[InstalledPackageStatus_StatusReason.STATUS_REASON_UNINSTALLED]} + statusesToDeactivate={[InstalledPackageStatus_StatusReason.UNINSTALLED]} > Delete diff --git a/dashboard/src/components/AppView/AppControls/RollbackButton/RollbackButton.test.tsx b/dashboard/src/components/AppView/AppControls/RollbackButton/RollbackButton.test.tsx index 7033d895abf..8b608480299 100644 --- a/dashboard/src/components/AppView/AppControls/RollbackButton/RollbackButton.test.tsx +++ b/dashboard/src/components/AppView/AppControls/RollbackButton/RollbackButton.test.tsx @@ -9,8 +9,8 @@ import { InstalledPackageReference, InstalledPackageStatus, InstalledPackageStatus_StatusReason, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { act } from "react-dom/test-utils"; import * as ReactRedux from "react-redux"; import { Tooltip as ReactTooltip } from "react-tooltip"; diff --git a/dashboard/src/components/AppView/AppSecrets/AppSecrets.test.tsx b/dashboard/src/components/AppView/AppSecrets/AppSecrets.test.tsx index f6a499ca757..8089b1197e3 100644 --- a/dashboard/src/components/AppView/AppSecrets/AppSecrets.test.tsx +++ b/dashboard/src/components/AppView/AppSecrets/AppSecrets.test.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { keyForResourceRef } from "shared/ResourceRef"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { defaultStore, getStore, initialState, mountWrapper } from "shared/specs/mountWrapper"; import { ISecret, IStoreState } from "shared/types"; import SecretItemDatum from "../ResourceTable/ResourceItem/SecretItem/SecretItemDatum"; diff --git a/dashboard/src/components/AppView/AppSecrets/AppSecrets.tsx b/dashboard/src/components/AppView/AppSecrets/AppSecrets.tsx index 057fe11733d..973c518a290 100644 --- a/dashboard/src/components/AppView/AppSecrets/AppSecrets.tsx +++ b/dashboard/src/components/AppView/AppSecrets/AppSecrets.tsx @@ -4,7 +4,7 @@ import LoadingWrapper from "components/LoadingWrapper"; import { isEmpty } from "lodash"; import { useSelector } from "react-redux"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { ISecret, IStoreState } from "shared/types"; import SecretItemDatum from "../ResourceTable/ResourceItem/SecretItem/SecretItemDatum"; import "./AppSecrets.css"; diff --git a/dashboard/src/components/AppView/AppView.test.tsx b/dashboard/src/components/AppView/AppView.test.tsx index 62d6a4bd630..9cdd8c8b337 100644 --- a/dashboard/src/components/AppView/AppView.test.tsx +++ b/dashboard/src/components/AppView/AppView.test.tsx @@ -20,8 +20,8 @@ import { PackageAppVersion, ResourceRef, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { act } from "react-dom/test-utils"; import { MemoryRouter, Route } from "react-router-dom"; import { IConfigState } from "reducers/config"; diff --git a/dashboard/src/components/AppView/AppView.tsx b/dashboard/src/components/AppView/AppView.tsx index 6c9b6c418ea..2db6235db7a 100644 --- a/dashboard/src/components/AppView/AppView.tsx +++ b/dashboard/src/components/AppView/AppView.tsx @@ -13,8 +13,8 @@ import { push } from "connected-react-router"; import { InstalledPackageReference, ResourceRef, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import placeholder from "icons/placeholder.svg"; import { useEffect, useMemo, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; @@ -229,17 +229,17 @@ export default function AppView() { useEffect(() => { if (resourceRefs.length === 0) { - return () => {}; + return () => { }; } const parsedRefs = parseResources(resourceRefs); setAppViewResourceRefs(parsedRefs); - return () => {}; + return () => { }; }, [resourceRefs]); useEffect(() => { if (!selectedInstalledPkg?.installedPackageRef) { - return () => {}; + return () => { }; } const installedPackageRef = selectedInstalledPkg.installedPackageRef; // Watch Deployments, StatefulSets, DaemonSets, Ingresses and Services. @@ -260,7 +260,7 @@ export default function AppView() { dispatch(actions.kube.closeRequestResources(installedPackageRef)); }; } - return () => {}; + return () => { }; }, [dispatch, selectedInstalledPkg?.installedPackageRef, appViewResourceRefs]); const forceRetry = () => { diff --git a/dashboard/src/components/AppView/PackageInfo/PackageInfo.test.tsx b/dashboard/src/components/AppView/PackageInfo/PackageInfo.test.tsx index 5e196e091a9..49574b71f4e 100644 --- a/dashboard/src/components/AppView/PackageInfo/PackageInfo.test.tsx +++ b/dashboard/src/components/AppView/PackageInfo/PackageInfo.test.tsx @@ -13,8 +13,8 @@ import { PackageAppVersion, ReconciliationOptions, VersionReference, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import context from "jest-plugin-context"; import { defaultStore, mountWrapper } from "shared/specs/mountWrapper"; import PackageInfo from "./PackageInfo"; @@ -30,12 +30,11 @@ const defaultProps = { plugin: { name: "my.plugin", version: "0.0.1" } as Plugin, } as AvailablePackageReference, currentVersion: { appVersion: "10.0.0", pkgVersion: "1.0.0" } as PackageAppVersion, - installedPackageRef: { + installedPackageRef: new InstalledPackageReference({ identifier: "apache/1", - pkgVersion: "1.0.0", context: { cluster: "", namespace: "package-namespace" } as Context, plugin: { name: "my.plugin", version: "0.0.1" } as Plugin, - } as InstalledPackageReference, + }), latestMatchingVersion: { appVersion: "10.0.0", pkgVersion: "1.0.0" } as PackageAppVersion, latestVersion: { appVersion: "10.0.0", pkgVersion: "1.0.0" } as PackageAppVersion, pkgVersionReference: { version: "1" } as VersionReference, diff --git a/dashboard/src/components/AppView/PackageInfo/PackageUpdateInfo.tsx b/dashboard/src/components/AppView/PackageInfo/PackageUpdateInfo.tsx index c43cdcf7b1f..b58a8c97fdb 100644 --- a/dashboard/src/components/AppView/PackageInfo/PackageUpdateInfo.tsx +++ b/dashboard/src/components/AppView/PackageInfo/PackageUpdateInfo.tsx @@ -3,7 +3,7 @@ import { CdsIcon } from "@cds/react/icon"; import Alert from "components/js/Alert"; -import { InstalledPackageDetail } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { InstalledPackageDetail } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { Link } from "react-router-dom"; import { app as appURL } from "shared/url"; interface IPackageUpdateInfoProps { @@ -16,7 +16,7 @@ export default function PackageUpdateInfo({ installedPackageDetail }: IPackageUp installedPackageDetail.latestVersion?.appVersion && installedPackageDetail.currentVersion?.appVersion && installedPackageDetail.currentVersion?.appVersion !== - installedPackageDetail.latestVersion?.appVersion + installedPackageDetail.latestVersion?.appVersion ) { // There is a new application version alertContent = ( @@ -29,7 +29,7 @@ export default function PackageUpdateInfo({ installedPackageDetail }: IPackageUp installedPackageDetail.latestVersion?.pkgVersion && installedPackageDetail.currentVersion?.pkgVersion && installedPackageDetail.latestVersion?.pkgVersion !== - installedPackageDetail.currentVersion?.pkgVersion + installedPackageDetail.currentVersion?.pkgVersion ) { // There is a new package version alertContent = ( diff --git a/dashboard/src/components/AppView/ResourceTable/ResourceTable.test.tsx b/dashboard/src/components/AppView/ResourceTable/ResourceTable.test.tsx index 9c73f632a2d..ffe873eaee1 100644 --- a/dashboard/src/components/AppView/ResourceTable/ResourceTable.test.tsx +++ b/dashboard/src/components/AppView/ResourceTable/ResourceTable.test.tsx @@ -3,7 +3,7 @@ import Table from "components/js/Table"; import LoadingWrapper from "components/LoadingWrapper/LoadingWrapper"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { keyForResourceRef } from "shared/ResourceRef"; import { getStore, initialState, mountWrapper } from "shared/specs/mountWrapper"; import { IResource, IStoreState } from "shared/types"; diff --git a/dashboard/src/components/AppView/ResourceTable/ResourceTable.tsx b/dashboard/src/components/AppView/ResourceTable/ResourceTable.tsx index 40d0a933d22..13384e4de83 100644 --- a/dashboard/src/components/AppView/ResourceTable/ResourceTable.tsx +++ b/dashboard/src/components/AppView/ResourceTable/ResourceTable.tsx @@ -6,7 +6,7 @@ import Table from "components/js/Table"; import LoadingWrapper from "components/LoadingWrapper/LoadingWrapper"; import { useMemo } from "react"; import { useSelector } from "react-redux"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { IKubeItem, IResource, ISecret, IStoreState } from "shared/types"; import { DaemonSetColumns } from "./ResourceData/DaemonSet"; import { DeploymentColumns } from "./ResourceData/Deployment"; diff --git a/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.test.tsx b/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.test.tsx index a6229548ca9..7ec21749c36 100644 --- a/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.test.tsx +++ b/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.test.tsx @@ -3,7 +3,7 @@ import Tabs from "components/Tabs"; import { shallow } from "enzyme"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import ResourceTabs from "./ResourceTabs"; const sampleResourceRef = { diff --git a/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.tsx b/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.tsx index 05847e28c5d..2b1841536cc 100644 --- a/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.tsx +++ b/dashboard/src/components/AppView/ResourceTabs/ResourceTabs.tsx @@ -3,7 +3,7 @@ import Tabs from "components/Tabs"; import ResourceTable from "components/AppView/ResourceTable"; -import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { ResourceRef } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; interface IAppViewResourceRefs { deployments: ResourceRef[]; diff --git a/dashboard/src/components/ApplicationStatus/ApplicationStatus.tsx b/dashboard/src/components/ApplicationStatus/ApplicationStatus.tsx index 04e78926735..d06f0737c87 100644 --- a/dashboard/src/components/ApplicationStatus/ApplicationStatus.tsx +++ b/dashboard/src/components/ApplicationStatus/ApplicationStatus.tsx @@ -8,7 +8,7 @@ import { InstalledPackageDetail, InstalledPackageStatus, InstalledPackageStatus_StatusReason, -} from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +} from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { flatten, get } from "lodash"; import { useEffect, useState } from "react"; import { PieChart } from "react-minimal-pie-chart"; diff --git a/dashboard/src/components/Catalog/AvailablePackageDetailExcerpt.tsx b/dashboard/src/components/Catalog/AvailablePackageDetailExcerpt.tsx index e30fc896096..404c50d60ef 100644 --- a/dashboard/src/components/Catalog/AvailablePackageDetailExcerpt.tsx +++ b/dashboard/src/components/Catalog/AvailablePackageDetailExcerpt.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import AvailablePackageMaintainers from "components/PackageHeader/AvailablePackageMaintainers"; -import { AvailablePackageDetail } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { AvailablePackageDetail } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; interface AvailablePackageDetailExcerptProps { pkg?: AvailablePackageDetail; diff --git a/dashboard/src/components/Catalog/Catalog.test.tsx b/dashboard/src/components/Catalog/Catalog.test.tsx index 83ccec7d9af..7c36c45e607 100644 --- a/dashboard/src/components/Catalog/Catalog.test.tsx +++ b/dashboard/src/components/Catalog/Catalog.test.tsx @@ -7,12 +7,12 @@ import FilterGroup from "components/FilterGroup/FilterGroup"; import InfoCard from "components/InfoCard/InfoCard"; import Alert from "components/js/Alert"; import LoadingWrapper from "components/LoadingWrapper"; -import { AvailablePackageSummary, Context } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { AvailablePackageSummary, Context } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { PackageRepositoryDetail, PackageRepositorySummary, -} from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +} from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { createMemoryHistory } from "history"; import React from "react"; import { act } from "react-dom/test-utils"; diff --git a/dashboard/src/components/Catalog/CatalogItem.tsx b/dashboard/src/components/Catalog/CatalogItem.tsx index 90224083040..8a3f58182ac 100644 --- a/dashboard/src/components/Catalog/CatalogItem.tsx +++ b/dashboard/src/components/Catalog/CatalogItem.tsx @@ -1,7 +1,7 @@ // Copyright 2018-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { AvailablePackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { AvailablePackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import OperatorCatalogItem from "./OperatorCatalogItem"; import PackageCatalogItem from "./PackageCatalogItem"; diff --git a/dashboard/src/components/Catalog/CatalogItems.test.tsx b/dashboard/src/components/Catalog/CatalogItems.test.tsx index b8bd0cad20f..93966372c24 100644 --- a/dashboard/src/components/Catalog/CatalogItems.test.tsx +++ b/dashboard/src/components/Catalog/CatalogItems.test.tsx @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import InfoCard from "components/InfoCard"; -import { AvailablePackageSummary, Context } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; +import { AvailablePackageSummary, Context } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; import { defaultStore, mountWrapper } from "shared/specs/mountWrapper"; import { IClusterServiceVersion, PluginNames } from "shared/types"; import CatalogItem from "./CatalogItem"; diff --git a/dashboard/src/components/Catalog/CatalogItems.tsx b/dashboard/src/components/Catalog/CatalogItems.tsx index 712ff21704b..92b103cd5ac 100644 --- a/dashboard/src/components/Catalog/CatalogItems.tsx +++ b/dashboard/src/components/Catalog/CatalogItems.tsx @@ -1,7 +1,7 @@ // Copyright 2020-2022 the Kubeapps contributors. // SPDX-License-Identifier: Apache-2.0 -import { AvailablePackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages"; +import { AvailablePackageSummary } from "gen/kubeappsapis/core/packages/v1alpha1/packages_pb"; import { useMemo } from "react"; import { getIcon } from "shared/Operators"; import { IClusterServiceVersion } from "shared/types"; @@ -79,14 +79,14 @@ export default function CatalogItems({ !hasLoadedFirstPage && isFirstPage ? [] : packageItems - .concat(crdItems) - .sort((a, b) => - a.item.name.toLowerCase() > b.item.name.toLowerCase() - ? 1 - : b.item.name.toLowerCase() > a.item.name.toLowerCase() + .concat(crdItems) + .sort((a, b) => + a.item.name.toLowerCase() > b.item.name.toLowerCase() + ? 1 + : b.item.name.toLowerCase() > a.item.name.toLowerCase() ? -1 : 0, - ); + ); if (hasFinishedFetching && sortedItems.length === 0) { return

No application matches the current filter.

; diff --git a/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.test.tsx b/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.test.tsx index c599915d7c1..d207a4ca976 100644 --- a/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.test.tsx +++ b/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.test.tsx @@ -5,7 +5,7 @@ import { CdsButton } from "@cds/react/button"; import { CdsIcon } from "@cds/react/icon"; import { CdsModal } from "@cds/react/modal"; import actions from "actions"; -import { PackageRepositoryReference } from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; +import { PackageRepositoryReference } from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; import { act } from "react-dom/test-utils"; import * as ReactRedux from "react-redux"; import { defaultStore, mountWrapper } from "shared/specs/mountWrapper"; diff --git a/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.tsx b/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.tsx index a905dbabc33..ee86c29eddc 100644 --- a/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.tsx +++ b/dashboard/src/components/Config/PkgRepoList/PkgRepoButton.tsx @@ -5,7 +5,7 @@ import { CdsButton } from "@cds/react/button"; import { CdsIcon } from "@cds/react/icon"; import { CdsModal, CdsModalContent, CdsModalHeader } from "@cds/react/modal"; import actions from "actions"; -import { PackageRepositoryReference } from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; +import { PackageRepositoryReference } from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; import { useState } from "react"; import { useDispatch } from "react-redux"; import { Action } from "redux"; diff --git a/dashboard/src/components/Config/PkgRepoList/PkgRepoControl.tsx b/dashboard/src/components/Config/PkgRepoList/PkgRepoControl.tsx index 53659bc6582..0f4a6cc88e1 100644 --- a/dashboard/src/components/Config/PkgRepoList/PkgRepoControl.tsx +++ b/dashboard/src/components/Config/PkgRepoList/PkgRepoControl.tsx @@ -5,7 +5,7 @@ import { CdsButton } from "@cds/react/button"; import { PackageRepositoryReference, PackageRepositorySummary, -} from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; +} from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; import { useState } from "react"; import { useDispatch } from "react-redux"; import { Action } from "redux"; diff --git a/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.test.tsx b/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.test.tsx index c6e7a58f852..28e549ffd0e 100644 --- a/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.test.tsx +++ b/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.test.tsx @@ -10,10 +10,10 @@ import { PackageRepositoryDetail, PackageRepositoryReference, PackageRepositorySummary, -} from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; -import { FluxPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2"; -import { HelmPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm"; +} from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; +import { FluxPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2_pb"; +import { HelmPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm_pb"; import { act } from "react-dom/test-utils"; import * as ReactRedux from "react-redux"; import { IPackageRepositoryState } from "reducers/repos"; diff --git a/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.tsx b/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.tsx index ed757b043fc..00aa58c6f6c 100644 --- a/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.tsx +++ b/dashboard/src/components/Config/PkgRepoList/PkgRepoForm.tsx @@ -22,10 +22,10 @@ import { PackageRepositoryAuth_PackageRepositoryAuthType, PackageRepositoryReference, UsernamePassword, -} from "gen/kubeappsapis/core/packages/v1alpha1/repositories"; -import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins"; -import { FluxPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2"; -import { HelmPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm"; +} from "gen/kubeappsapis/core/packages/v1alpha1/repositories_pb"; +import { Plugin } from "gen/kubeappsapis/core/plugins/v1alpha1/plugins_pb"; +import { FluxPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/fluxv2/packages/v1alpha1/fluxv2_pb"; +import { HelmPackageRepositoryCustomDetail } from "gen/kubeappsapis/plugins/helm/packages/v1alpha1/helm_pb"; import { useCallback, useEffect, useRef, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Action } from "redux"; @@ -221,7 +221,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { setOpaqueData(JSON.stringify(repo.auth?.opaqueCreds?.data) || ""); setAuthMethod( repo.auth?.type || - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED, + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED, ); setSecretAuthName(repo.auth?.secretRef?.name || ""); setSecretTLSName(repo.tlsConfig?.secretRef?.name || ""); @@ -297,7 +297,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { if ( authMethod === PackageRepositoryAuth_PackageRepositoryAuthType.UNRECOGNIZED || authMethod === - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED ) { if (hasAuthProvider()) { handleFluxAuthProviderAuthChange(); @@ -408,7 +408,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { secretRef: helmPSAuthMethod === PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON && - isUserManagedPSSecret + isUserManagedPSSecret ? useSameAuthCreds ? secretAuthName : secretPSName @@ -416,13 +416,13 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { credentials: helmPSAuthMethod === PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON && - !isUserManagedPSSecret + !isUserManagedPSSecret ? { - email: useSameAuthCreds ? secretEmail : pullSecretEmail, - username: useSameAuthCreds ? secretUser : pullSecretUser, - password: useSameAuthCreds ? secretPassword : pullSecretPassword, - server: useSameAuthCreds ? secretServer : pullSecretServer, - } + email: useSameAuthCreds ? secretEmail : pullSecretEmail, + username: useSameAuthCreds ? secretUser : pullSecretUser, + password: useSameAuthCreds ? secretPassword : pullSecretPassword, + server: useSameAuthCreds ? secretServer : pullSecretServer, + } : undefined, }, } as HelmPackageRepositoryCustomDetail; @@ -704,7 +704,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { required={ isUserManagedSecret && authMethod !== - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED } pattern={k8sObjectNameRegex} title="Use lower case alphanumeric characters, '-' or '.'" @@ -859,9 +859,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { - - - - - - - - - - )} + <> + + + + + + + + + + )} {plugin?.name === PluginNames.PACKAGES_KAPP && ( <> @@ -1068,8 +1067,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED ] || "" } checked={ @@ -1088,7 +1087,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { value="flux-auth-provider" checked={ authMethod === - PackageRepositoryAuth_PackageRepositoryAuthType.UNRECOGNIZED && + PackageRepositoryAuth_PackageRepositoryAuthType.UNRECOGNIZED && showAuthProviderDetails } onChange={handleFluxAuthProviderAuthChange} @@ -1103,8 +1102,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_BASIC_AUTH ] || "" } checked={ @@ -1127,8 +1126,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_BEARER + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_BEARER ] || "" } checked={ @@ -1153,8 +1152,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON ] || "" } checked={ @@ -1179,8 +1178,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_AUTHORIZATION_HEADER ] || "" } checked={ @@ -1205,8 +1204,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_SSH + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_SSH ] || "" } checked={ @@ -1231,8 +1230,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_TLS + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_TLS ] || "" } checked={ @@ -1257,8 +1256,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_OPAQUE ] || "" } checked={ @@ -1661,8 +1660,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED ] || "" } checked={ @@ -1687,8 +1686,8 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { name="auth" value={ PackageRepositoryAuth_PackageRepositoryAuthType[ - PackageRepositoryAuth_PackageRepositoryAuthType - .PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON + PackageRepositoryAuth_PackageRepositoryAuthType + .PACKAGE_REPOSITORY_AUTH_TYPE_DOCKER_CONFIG_JSON ] || "" } checked={ @@ -1780,7 +1779,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { required={ isUserManagedPSSecret && helmPSAuthMethod !== - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED } pattern={k8sObjectNameRegex} title="Use lower case alphanumeric characters, '-' or '.'" @@ -1814,7 +1813,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { required={ !isUserManagedPSSecret && helmPSAuthMethod !== - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED } /> @@ -1831,7 +1830,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { required={ !isUserManagedPSSecret && helmPSAuthMethod !== - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED } /> @@ -1849,7 +1848,7 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { required={ !isUserManagedPSSecret && helmPSAuthMethod !== - PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED + PackageRepositoryAuth_PackageRepositoryAuthType.PACKAGE_REPOSITORY_AUTH_TYPE_UNSPECIFIED } /> @@ -2002,82 +2001,82 @@ export function PkgRepoForm(props: IPkgRepoFormProps) { {([PluginNames.PACKAGES_HELM, PluginNames.PACKAGES_FLUX] as string[]).includes( plugin?.name, ) && ( - <> - - - - - - - {isUserManagedCASecret ? ( - <> - - -
- - Name of the{" "} -
- Kubernetes Secret - {" "} - object holding the TLS Certificate Authority data. - - - ) : ( - <> - - -