-
Notifications
You must be signed in to change notification settings - Fork 31
/
cluster_group.go
40 lines (29 loc) · 1.28 KB
/
cluster_group.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Copyright © 2023 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: MPL-2.0
*/
package scope
import (
"github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper"
helmclustergroupmodel "github.com/vmware/terraform-provider-tanzu-mission-control/internal/models/helmfeature/clustergroup"
commonscope "github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/common/scope"
)
func ConstructClusterGroupHelmFullname(data []interface{}) (fullname *helmclustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupFluxcdHelmFullName) {
if len(data) == 0 || data[0] == nil {
return fullname
}
fullNameData, _ := data[0].(map[string]interface{})
fullname = &helmclustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupFluxcdHelmFullName{}
if nameValue, ok := fullNameData[commonscope.NameKey]; ok {
helper.SetPrimitiveValue(nameValue, &fullname.ClusterGroupName, commonscope.NameKey)
}
return fullname
}
func FlattenClusterGroupHelmFullname(fullname *helmclustergroupmodel.VmwareTanzuManageV1alpha1ClustergroupFluxcdHelmFullName) (data []interface{}) {
if fullname == nil {
return data
}
flattenFullname := make(map[string]interface{})
flattenFullname[commonscope.NameKey] = fullname.ClusterGroupName
return []interface{}{flattenFullname}
}