Skip to content

Commit aabd05b

Browse files
committed
refactor: update ThreatWinds config parameter keys and add metadata fields
1 parent 666ee1d commit aabd05b

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

threadwinds-ingestion/internal/client/backend_client.go

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ type ThreadWindsConfig struct {
105105
}
106106

107107
type ConfigParameter struct {
108-
ID int64 `json:"id"`
109-
SectionID int64 `json:"sectionId"`
110-
ConfParamShort string `json:"confParamShort"`
111-
ConfParamValue string `json:"confParamValue"`
108+
ID int64 `json:"id"`
109+
SectionID int64 `json:"sectionId"`
110+
ConfParamShort string `json:"confParamShort"`
111+
ConfParamLarge string `json:"confParamLarge,omitempty"`
112+
ConfParamDescription string `json:"confParamDescription,omitempty"`
113+
ConfParamValue string `json:"confParamValue"`
114+
ConfParamRequired bool `json:"confParamRequired,omitempty"`
115+
ConfParamDatatype string `json:"confParamDatatype,omitempty"`
112116
}
113117

114118
func (c *BackendClient) GetThreadWindsConfig(ctx context.Context) (*ThreadWindsConfig, error) {
@@ -142,10 +146,10 @@ func (c *BackendClient) GetThreadWindsConfig(ctx context.Context) (*ThreadWindsC
142146

143147
for _, param := range params {
144148
switch param.ConfParamShort {
145-
case "THREADWINDS_API_KEY":
149+
case "utmstack.tw.apiKey":
146150
config.APIKey = param.ConfParamValue
147151
config.KeyID = param.ID
148-
case "THREADWINDS_API_SECRET":
152+
case "utmstack.tw.apiSecret":
149153
config.APISecret = param.ConfParamValue
150154
config.SecretID = param.ID
151155
}
@@ -160,16 +164,24 @@ func (c *BackendClient) SaveThreadWindsCredentials(ctx context.Context, apiKey,
160164

161165
params := []ConfigParameter{
162166
{
163-
ID: keyID,
164-
SectionID: threadwindsSectionID,
165-
ConfParamShort: "THREADWINDS_API_KEY",
166-
ConfParamValue: apiKey,
167+
ID: keyID,
168+
SectionID: threadwindsSectionID,
169+
ConfParamShort: "utmstack.tw.apiKey",
170+
ConfParamLarge: "ThreatWinds API Key",
171+
ConfParamDescription: "API Key for ThreatWinds integration.",
172+
ConfParamValue: apiKey,
173+
ConfParamRequired: true,
174+
ConfParamDatatype: "text",
167175
},
168176
{
169-
ID: secretID,
170-
SectionID: threadwindsSectionID,
171-
ConfParamShort: "THREADWINDS_API_SECRET",
172-
ConfParamValue: apiSecret,
177+
ID: secretID,
178+
SectionID: threadwindsSectionID,
179+
ConfParamShort: "utmstack.tw.apiSecret",
180+
ConfParamLarge: "ThreatWinds API Secret",
181+
ConfParamDescription: "API Secret for ThreatWinds integration.",
182+
ConfParamValue: apiSecret,
183+
ConfParamRequired: true,
184+
ConfParamDatatype: "password",
173185
},
174186
}
175187

0 commit comments

Comments
 (0)