Onboard Argus alert configs (#449)
* Onboard Argus alert config receivers (#439) * initial schema and to payload * finish receiver resource implementation (schema, topayload and mapfields) * fix toUpdate payload lists * fix resource and datasource on alert config attr removal, add testing * fix linting and testing * initial test map fields * improve testing, remove logging * rename vars in acc testing * refactor mapAlertConfig * improve mock alert config, fix testing * make the mock alert config receivers match the default * generate docs * Onboard Argus Alert Config global configuration (#446) * initial implementation * initial map fields * extend datasource, finish resource impl and extend acc testing * remove unmapped fields * add all attributes back * remove commented inhibit rules * generate docs, fix testing * address PR comments * Onboard Alert Config route (#447) * Initial implementation * add schema to datasource, improve acc testing * fix linting, generate docs * address PR comments * fix and improve acceptance tests * update test titles (comments) * address acceptance comments (#452) * Onboard Argus Alert Config child routes in Route (#463) * initial schema and map fields implementation * initial working solution * improve implementation, generate docs * fix description, add more unit testing * address PR comments * add unit and acc testing, fix datasource schema, fix plan_id mapping * add checks to acceptance testing * update acceptance tests
This commit is contained in:
parent
f762c4800b
commit
a35b887315
8 changed files with 3081 additions and 9 deletions
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
)
|
||||
|
||||
func ToString(ctx context.Context, v attr.Value) (string, error) {
|
||||
|
|
@ -58,6 +59,22 @@ func ToTerraformStringMap(ctx context.Context, m map[string]string) (basetypes.M
|
|||
return res, nil
|
||||
}
|
||||
|
||||
// ToStringInterfaceMap converts a basetypes.MapValue of Strings to a map[string]interface{}.
|
||||
func ToStringInterfaceMap(ctx context.Context, m basetypes.MapValue) (map[string]interface{}, error) {
|
||||
labels := map[string]string{}
|
||||
diags := m.ElementsAs(ctx, &labels, false)
|
||||
if diags.HasError() {
|
||||
return nil, fmt.Errorf("converting from MapValue: %w", core.DiagsToError(diags))
|
||||
}
|
||||
|
||||
interfaceMap := make(map[string]interface{}, len(labels))
|
||||
for k, v := range labels {
|
||||
interfaceMap[k] = v
|
||||
}
|
||||
|
||||
return interfaceMap, nil
|
||||
}
|
||||
|
||||
// StringValueToPointer converts basetypes.StringValue to a pointer to string.
|
||||
// It returns nil if the value is null or unknown.
|
||||
func StringValueToPointer(s basetypes.StringValue) *string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue