in internal/clients/config/kibana_oapi.go [17:63]
func newKibanaOapiConfigFromSDK(d *schema.ResourceData, base baseConfig) (kibanaOapiConfig, sdkdiags.Diagnostics) {
var diags sdkdiags.Diagnostics
// Use ES details by default
config := base.toKibanaOapiConfig()
kibConn, ok := d.GetOk("kibana")
if !ok {
return config, diags
}
// if defined, then we only have a single entry
if kib := kibConn.([]interface{})[0]; kib != nil {
kibConfig := kib.(map[string]interface{})
if username, ok := kibConfig["username"]; ok && username != "" {
config.Username = username.(string)
}
if password, ok := kibConfig["password"]; ok && password != "" {
config.Password = password.(string)
}
if apiKey, ok := kibConfig["api_key"]; ok && apiKey != "" {
config.APIKey = apiKey.(string)
}
if endpoints, ok := kibConfig["endpoints"]; ok && len(endpoints.([]interface{})) > 0 {
// We're curently limited by the API to a single endpoint
if endpoint := endpoints.([]interface{})[0]; endpoint != nil {
config.URL = endpoint.(string)
}
}
if caCerts, ok := kibConfig["ca_certs"].([]interface{}); ok && len(caCerts) > 0 {
for _, elem := range caCerts {
if vStr, elemOk := elem.(string); elemOk {
config.CACerts = append(config.CACerts, vStr)
}
}
}
if insecure, ok := kibConfig["insecure"]; ok && insecure.(bool) {
config.Insecure = true
}
}
return config.withEnvironmentOverrides(), nil
}