Onboard Argus (ACL): fix edge cases (#314)
* fix empty acl update/create, update CIDR validator * fix sigsegv in test, acl description * Split field mapping, better handle edge cases * Update stackit/internal/services/argus/instance/resource.go Co-authored-by: Vicente Pinto <vicente.pinto@freiheit.com> --------- Co-authored-by: Vicente Pinto <vicente.pinto@freiheit.com>
This commit is contained in:
parent
056c000acc
commit
394d5bf8d6
5 changed files with 99 additions and 24 deletions
|
|
@ -227,11 +227,17 @@ func (d *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
|
|||
return
|
||||
}
|
||||
|
||||
err = mapFields(ctx, instanceResponse, aclList, &model)
|
||||
// Map response body to schema
|
||||
err = mapFields(ctx, instanceResponse, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
}
|
||||
err = mapACLField(aclList, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API response for the ACL: %v", err))
|
||||
return
|
||||
}
|
||||
diags = resp.State.Set(ctx, model)
|
||||
resp.Diagnostics.Append(diags...)
|
||||
if resp.Diagnostics.HasError() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue