feat: refactor resource schema handling and add plan modifiers configuration
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 6m27s
CI Workflow / CI (pull_request) Failing after 6m32s
CI Workflow / Code coverage report (pull_request) Has been skipped
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 6m27s
CI Workflow / CI (pull_request) Failing after 6m32s
CI Workflow / Code coverage report (pull_request) Has been skipped
This commit is contained in:
parent
062fd98870
commit
9b57339776
13 changed files with 312 additions and 134 deletions
|
|
@ -2,6 +2,7 @@ package sqlserverflexalpha
|
|||
|
||||
import (
|
||||
"context"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -53,8 +54,24 @@ func (r *databaseResource) Metadata(_ context.Context, req resource.MetadataRequ
|
|||
resp.TypeName = req.ProviderTypeName + "_sqlserverflexalpha_database"
|
||||
}
|
||||
|
||||
//go:embed planModifiers.yaml
|
||||
var modifiersFileByte []byte
|
||||
|
||||
func (r *databaseResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
resp.Schema = sqlserverflexalphaGen.DatabaseResourceSchema(ctx)
|
||||
s := sqlserverflexalphaGen.DatabaseResourceSchema(ctx)
|
||||
|
||||
fields, err := utils.ReadModifiersConfig(modifiersFileByte)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("error during read modifiers config file", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err = utils.AddPlanModifiersToResourceSchema(fields, &s)
|
||||
if err != nil {
|
||||
resp.Diagnostics.AddError("error adding plan modifiers", err.Error())
|
||||
return
|
||||
}
|
||||
resp.Schema = s
|
||||
}
|
||||
|
||||
func (r *databaseResource) IdentitySchema(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue