Skip to content

Commit

Permalink
check mtls test
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-omerma committed Dec 8, 2024
1 parent a96aab2 commit 31be2fb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/resources/web-app-asset/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ func mapToMTLSInput(mTLSMap map[string]any) models.FileSchema {

mTLSFile = models.NewFileSchemaEncode(mTLSFile.Filename, mTLSFile.Data, mTLSFile.Type, mTLSFile.Enable)

if mTLSMap["filename_id"] != nil {
mTLSFile.FilenameID = mTLSMap["filename_id"].(string)
}

if mTLSMap["data_id"] != nil {
mTLSFile.DataID = mTLSMap["data_id"].(string)
}

if mTLSMap["enable_id"] != nil {
mTLSFile.EnableID = mTLSMap["enable_id"].(string)
}

return mTLSFile
}

Expand Down
12 changes: 12 additions & 0 deletions internal/resources/web-app-asset/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,27 @@ func UpdateWebApplicationAssetInputFromResourceData(d *schema.ResourceData, asse
}

if oldMTLS.Data != newMTLS.Data {
key := "upstreamTrustedCAFile"
if oldMTLS.Type == "server" {
key = "trustedCAListFile"
}

updateInput.UpdateProxySetting = append(updateInput.UpdateProxySetting, models.UpdateProxySetting{
ID: oldMTLS.DataID,
Key: key,
Value: newMTLS.Data,
})
}

if oldMTLS.Filename != newMTLS.Filename {
key := "upstreamTrustedCAFileName"
if oldMTLS.Type == "server" {
key = "trustedCAListFileName"
}

updateInput.UpdateProxySetting = append(updateInput.UpdateProxySetting, models.UpdateProxySetting{
ID: oldMTLS.FilenameID,
Key: key,
Value: newMTLS.Filename,
})
}
Expand Down

0 comments on commit 31be2fb

Please sign in to comment.