Onboard Argus ACL (#304)
* resource create and schema/model * consider empty value in resource creation * Address issue in mapfields that came up in testing * Unit testing the mapFields func * extend update * extend read * extend datasource.go * update example * extended acceptance tests and generated docs * update description and comments * improve messages and var names, fix update acceptance test * extend acceptance tests, improve error messages
This commit is contained in:
parent
8eb14a1136
commit
c2389be47b
7 changed files with 379 additions and 22 deletions
|
|
@ -196,6 +196,11 @@ func (d *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaReques
|
|||
"zipkin_spans_url": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"acl": schema.SetAttribute{
|
||||
Description: "The access control list for this instance. Each entry is a single IP address that is permitted to access, in CIDR notation (/32).",
|
||||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -216,7 +221,13 @@ func (d *instanceDataSource) Read(ctx context.Context, req datasource.ReadReques
|
|||
return
|
||||
}
|
||||
|
||||
err = mapFields(ctx, instanceResponse, &model)
|
||||
aclList, 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
|
||||
}
|
||||
|
||||
err = mapFields(ctx, instanceResponse, aclList, &model)
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Processing API payload: %v", err))
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue