import "@goauthentik/admin/common/ak-crypto-certificate-search"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { first } from "@goauthentik/common/utils"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import "@goauthentik/elements/forms/SearchSelect"; import { msg } from "@lit/localize"; import { TemplateResult, html } from "lit"; import { customElement } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { DockerServiceConnection, OutpostsApi } from "@goauthentik/api"; @customElement("ak-service-connection-docker-form") export class ServiceConnectionDockerForm extends ModelForm { loadInstance(pk: string): Promise { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerRetrieve({ uuid: pk, }); } getSuccessMessage(): string { return this.instance ? msg("Successfully updated integration.") : msg("Successfully created integration."); } async send(data: DockerServiceConnection): Promise { if (this.instance) { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerUpdate({ uuid: this.instance.pk || "", dockerServiceConnectionRequest: data, }); } else { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerCreate({ dockerServiceConnectionRequest: data, }); } } renderForm(): TemplateResult { return html`

${msg( "If enabled, use the local connection. Required Docker socket/Kubernetes Integration.", )}

${msg( "Can be in the format of 'unix://' when connecting to a local docker daemon, using 'ssh://' to connect via SSH, or 'https://:2376' when connecting to a remote system.", )}

${msg( "CA which the endpoint's Certificate is verified against. Can be left empty for no validation.", )}

${msg( "Certificate/Key used for authentication. Can be left empty for no authentication.", )}

${msg("When connecting via SSH, this keypair is used for authentication.")}

`; } } declare global { interface HTMLElementTagNameMap { "ak-service-connection-docker-form": ServiceConnectionDockerForm; } }