def set_managed
import cswap-bend-cli@0.1.0.0/swbase.bend as Swbaseimport Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
89# A managed API key goes in as primaryApiKey and is approved by its last 20
90# characters (credentials.py _write_managed_credentials, file backend).
91def set_managed(+cfg: Json.Json, +key: String) -> Json.Json:
92 Json.set("primaryApiKey", Json.JStr{String.trim(key)},
93 Json.set("customApiKeyResponses", managed_responses(responses_of(cfg), approved_form(key)), cfg))