Skip to content

credential ​

Tipo
Referência
Para
Desenvolvedor, Engenharia de dados

Os nós de extração dos Dataflows chegam a um banco ou a uma API por uma credential, a conexão guardada em credentials/<slug>--<id>.yaml. Como as conexões entram no HorusETL está em HorusETL.

bash
lumo new credential --type postgres --name "ERP Produção"
lumo scaffold credential postgres     # as chaves de config de um driver

Campos ​

  • fileName
    string · opcional · valores: regex ^[a-z0-9-]+--\d+\.yaml$
  • header
    object · obrigatório
  • header.id
    integer · obrigatório · valores: ≥ 1
  • header.kind
    string · obrigatório · valores: credential (fixo)
  • header.lumo
    string · obrigatório · valores: v2 (fixo)
  • header.tenantId
    integer · obrigatório · valores: ≥ 1
  • header.appId
    integer · opcional · valores: ≥ 1
  • header.dashboardId
    integer · opcional · valores: ≥ 1
  • body
    object · obrigatório
  • body.criado_em
    string ou null · opcional · valores: regex ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$
    Somente leitura: o servidor preenche.
  • body.criado_por
    string ou integer ou null · opcional
    Somente leitura: o servidor preenche.
  • body.publicado_em
    string ou null · opcional · valores: regex ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$
    Somente leitura: o servidor preenche.
  • body.publicado_por
    string ou integer ou null · opcional
    Somente leitura: o servidor preenche.
  • body.nome
    string · obrigatório · valores: não vazio
  • body.type
    string · obrigatório · valores: mysql, postgresql, bigquery, http, sqlserver, oracle, firebird, informix, odbc, iris
  • body.key
    string ou null · opcional
    Somente leitura: o servidor preenche. Server-managed credential key. This is the value flow nodes put in Credential: - not the id and not the nome. Edits are ignored on push.
  • body.version
    integer ou null · opcional · valores: ≥ 0
    Somente leitura: o servidor preenche. Server-managed resource version.
  • body.password
    string · opcional
    Editable when present; omitted on GET/self-healed YAML to keep the existing server-side secret.
  • body.config
    object · obrigatório
  • body.config.host
    string · opcional
  • body.config.port
    integer · opcional · valores: ≥ 1, ≤ 65535
  • body.config.database
    string · opcional
  • body.config.username
    string · opcional
  • body.config.password
    string · opcional
    Editable when present; omitted on GET/self-healed YAML to keep the existing server-side secret.

Exemplo ​

yaml
# credentials/erp-producao--944.yaml
# yaml-language-server: $schema=https://docs.horusbi.com.br/schemas/v2/credential.schema.json
id: 944
kind: credential
lumo: v2
tenantId: 1200
---
nome: ERP Produção
type: postgresql                 # no YAML é postgresql, mesmo criado com --type postgres
config:
  host: db.loja-exemplo.com.br
  port: 5432
  database: erp
  username: lumo_leitura         # usuário só de leitura na origem
# Só na criação ou na troca da senha. Depois do pull ela some do arquivo;
# sem ela no push, o servidor mantém a que já tem.
password: "troque-esta-senha"

Limites ​

  • O nó de extração aponta para a credencial pelo campo key, que o servidor gera: no Dataflow, a opção Credential do nó recebe erp-producao. Não use o id nem o nome. lumo list credential mostra as chaves. Editar key no YAML não tem efeito.
  • A flag --type do lumo new credential aceita postgres, mas o arquivo sai com type: postgresql, que é o valor do esquema. Um YAML escrito à mão com type: postgres é recusado pelo lint.
  • password só se escreve. O servidor nunca a devolve, então ela some do arquivo depois de um pull. Um push sem password mantém a senha que já está no servidor.
  • config aceita chaves próprias de cada driver, que o esquema não restringe. lumo scaffold credential <driver> mostra as de cada um; a forma antiga --variant <driver> está obsoleta.
  • Use na origem um usuário só de leitura: o Dataflow não escreve no sistema de origem.
  • lumo credential test testa a conexão, e lumo credential move-flows passa os Dataflows de uma credencial para outra.