nf discover codify
Write Netherframe code for live objects. Keycloak is supported: a realm and what it holds.
Synopsis
nf discover codify keycloak --url URL --realm REALM [OPTIONS]
Options
--url TEXT: Keycloak server URL (orKEYCLOAK_URL)--realm TEXT: the realm to codify--output, -o PATH: file to write the code to (default: standard output)--username TEXT,--password TEXT: admin credentials (orKEYCLOAK_USER,KEYCLOAK_PASSWORD; prefer the variables)--client-id TEXT,--client-secret TEXT: client credentials (orKEYCLOAK_CLIENT_ID,KEYCLOAK_CLIENT_SECRET)--auth-realm TEXT: realm to authenticate in (defaultmaster, orKEYCLOAK_REALM)--include-users: codify users too--include-builtin: also codify the clients, client scopes, roles and flows every realm is created with--manifest PATH: where to write the adoption manifest (default with--output:<name>.adopt.jsonbeside the code)--bindings [auto|typed|generic]: generated typed classes, generic constructs, or typed when installed (defaultauto)--provider-version TEXT:keycloak/keycloakversion in the provider cache (defaultlatest)--provider-binary PATH: provider binary to use instead of the cache--insecure: do not verify the server's TLS certificate
Behavior
The realm is read through the admin API, every object is imported through the provider and read, and the module is written from the provider's state. Secrets are never written: the summary on standard error lists the environment variables the code reads them from, and any object that could not be codified.
The adoption manifest maps each construct's address to the import ID of the existing object it
stands for: nf plan --adopt-from shows those objects as imports, and the apply
adopts them (see Adopting Existing Infrastructure).
The code itself holds no import blocks.
Example
export KEYCLOAK_USER=admin KEYCLOAK_PASSWORD=...
nf discover codify keycloak --url http://localhost:8080 --realm demo -o realm_demo.py