import { CryptoApi, DockerServiceConnection, OutpostsApi } from "authentik-api"; import { gettext } from "django"; import { customElement, property } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../api/Config"; import { Form } from "../../elements/forms/Form"; import { until } from "lit-html/directives/until"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; @customElement("ak-service-connection-docker-form") export class ServiceConnectionDockerForm extends Form { set scUUID(value: string) { new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerRead({ uuid: value, }).then(sc => { this.sc = sc; }); } @property({attribute: false}) sc?: DockerServiceConnection; getSuccessMessage(): string { if (this.sc) { return gettext("Successfully updated service-connection."); } else { return gettext("Successfully created service-connection."); } } send = (data: DockerServiceConnection): Promise => { if (this.sc) { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerUpdate({ uuid: this.sc.pk || "", data: data }); } else { return new OutpostsApi(DEFAULT_CONFIG).outpostsServiceConnectionsDockerCreate({ data: data }); } }; renderForm(): TemplateResult { return html`

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

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

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

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

`; } }