Allow users to set Argus metrics storage retention policy (#393)

* implement crud commands

* resource testing

* acceptance tests

* move function to utils, cleanup tests

* fix linting

* use conversion pkg for int conversion, extend testing

* address PR comments

* address PR comments
This commit is contained in:
Diogo Ferrão 2024-06-06 16:54:03 +01:00 committed by GitHub
parent a86f2250ad
commit f941e53b15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 553 additions and 116 deletions

View file

@ -233,7 +233,7 @@ func (d *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
return
}
aclList, err := d.client.ListACL(ctx, instanceId, projectId).Execute()
aclListResp, err := d.client.ListACL(ctx, instanceId, projectId).Execute()
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Calling API to list ACL data: %v", err))
return
@ -245,11 +245,12 @@ func (d *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Processing API payload: %v", err))
return
}
err = mapACLField(aclList, &model)
err = mapACLField(aclListResp, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API response for the ACL: %v", err))
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading 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() {