Skip to content

Commit

Permalink
Populate meta data in provisioner read
Browse files Browse the repository at this point in the history
Signed-off-by: Shobha M <mshobha@vmware.com>
  • Loading branch information
shobha2626 committed Feb 20, 2024
1 parent aa47e00 commit 9e90b90
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions internal/resources/common/objectmeta_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper"
"github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper/converter"

Check failure on line 15 in internal/resources/common/objectmeta_schema.go

View workflow job for this annotation

GitHub Actions / lint

ST1019: package "github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper/converter" is being imported more than once (stylecheck)
tfModelConverterHelper "github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper/converter"

Check failure on line 16 in internal/resources/common/objectmeta_schema.go

View workflow job for this annotation

GitHub Actions / lint

ST1019(related information): other import of "github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper/converter" (stylecheck)

Check failure on line 16 in internal/resources/common/objectmeta_schema.go

View workflow job for this annotation

GitHub Actions / lint

ST1019(related information): other import of "github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper/converter" (stylecheck)
objectmetamodel "github.com/vmware/terraform-provider-tanzu-mission-control/internal/models/objectmeta"
)

Expand Down Expand Up @@ -186,3 +187,21 @@ func GetMetaConverterMap(modelPathSeparator string) *converter.BlockToStruct {

return MetaConverterMap
}

var provisionerArrayField = tfModelConverterHelper.BuildArrayField("provisioners")

func GetMetaConverterMapProvisioner(modelPathSeparator string) *converter.BlockToStruct {
var MetaConverterMap = &converter.BlockToStruct{
AnnotationsKey: &converter.Map{
converter.AllMapKeysFieldMarker: converter.BuildModelPath(modelPathSeparator, provisionerArrayField, "meta", "annotations", converter.AllMapKeysFieldMarker),
},
LabelsKey: &converter.Map{
converter.AllMapKeysFieldMarker: converter.BuildModelPath(modelPathSeparator, provisionerArrayField, "meta", "labels", converter.AllMapKeysFieldMarker),
},
DescriptionKey: converter.BuildModelPath(modelPathSeparator, provisionerArrayField, "meta", "description"),
resourceVersionKey: converter.BuildModelPath(modelPathSeparator, provisionerArrayField, "meta", "resourceVersion"),
uidKey: converter.BuildModelPath(modelPathSeparator, provisionerArrayField, "meta", "uid"),
}

return MetaConverterMap
}
2 changes: 1 addition & 1 deletion internal/resources/provisioner/converter_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var tfDataModelMap = &tfModelConverterHelper.BlockToStruct{
{
managementClusterNameKey: tfModelConverterHelper.BuildDefaultModelPath(provisionerArrayField, "fullName", "managementClusterName"),
nameKey: tfModelConverterHelper.BuildDefaultModelPath(provisionerArrayField, "fullName", "name"),
common.MetaKey: common.GetMetaConverterMap(tfModelConverterHelper.DefaultModelPathSeparator),
common.MetaKey: common.GetMetaConverterMapProvisioner(tfModelConverterHelper.DefaultModelPathSeparator),
},
},
}
Expand Down

0 comments on commit 9e90b90

Please sign in to comment.