import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/CodeMirror"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import YAML from "yaml"; import { t } from "@lingui/macro"; import { TemplateResult, html } from "lit"; import { customElement } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { KubernetesServiceConnection, OutpostsApi } from "@goauthentik/api"; @customElement("ak-service-connection-kubernetes-form") export class ServiceConnectionKubernetesForm extends ModelForm< KubernetesServiceConnection, string > { loadInstance(pk: string): Promise { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsKubernetesRetrieve({ uuid: pk, }); } getSuccessMessage(): string { if (this.instance) { return t`Successfully updated integration.`; } else { return t`Successfully created integration.`; } } send = (data: KubernetesServiceConnection): Promise => { if (this.instance) { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsKubernetesUpdate({ uuid: this.instance.pk || "", kubernetesServiceConnectionRequest: data, }); } else { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsKubernetesCreate({ kubernetesServiceConnectionRequest: data, }); } }; renderForm(): TemplateResult { return html`

${t`If enabled, use the local connection. Required Docker socket/Kubernetes Integration.`}

${t`Set custom attributes using YAML or JSON.`}

`; } }