feat: refactor data source models and update mapping functions for improved consistency
This commit is contained in:
parent
f0e7c19cdf
commit
184e133a2a
34 changed files with 980 additions and 1017 deletions
|
|
@ -9,10 +9,10 @@ import (
|
|||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/utils"
|
||||
)
|
||||
|
||||
// mapFields maps fields from a ListDatabase API response to a ResourceModel for the data source.
|
||||
// mapFields maps fields from a ListDatabase API response to a resourceModel for the data source.
|
||||
func mapFields(
|
||||
source *postgresflexalpha.ListDatabase,
|
||||
model *DataSourceModel,
|
||||
model *dataSourceModel,
|
||||
region string,
|
||||
) error {
|
||||
if source == nil {
|
||||
|
|
@ -51,8 +51,8 @@ func mapFields(
|
|||
return nil
|
||||
}
|
||||
|
||||
// mapResourceFields maps fields from a ListDatabase API response to a ResourceModel for the resource.
|
||||
func mapResourceFields(source *postgresflexalpha.ListDatabase, model *ResourceModel) error {
|
||||
// mapResourceFields maps fields from a ListDatabase API response to a resourceModel for the resource.
|
||||
func mapResourceFields(source *postgresflexalpha.ListDatabase, model *resourceModel) error {
|
||||
if source == nil {
|
||||
return fmt.Errorf("response is nil")
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ func mapResourceFields(source *postgresflexalpha.ListDatabase, model *ResourceMo
|
|||
}
|
||||
|
||||
// toCreatePayload converts the resource model to an API create payload.
|
||||
func toCreatePayload(model *ResourceModel) (*postgresflexalpha.CreateDatabaseRequestPayload, error) {
|
||||
func toCreatePayload(model *resourceModel) (*postgresflexalpha.CreateDatabaseRequestPayload, error) {
|
||||
if model == nil {
|
||||
return nil, fmt.Errorf("nil model")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue