4.5.1
This commit is contained in:
49
internal/service/cloudbroker/pcidevice/flattens.go
Normal file
49
internal/service/cloudbroker/pcidevice/flattens.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package pcidevice
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/pcidevice"
|
||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/flattens"
|
||||
)
|
||||
|
||||
func flattenPcidevice(d *schema.ResourceData, pd *pcidevice.ItemPCIDevice) {
|
||||
log.Debugf("flattenPCIDevice: ID %d", pd.ID)
|
||||
|
||||
d.Set("ckey", pd.CKey)
|
||||
d.Set("meta", flattens.FlattenMeta(pd.Meta))
|
||||
d.Set("compute_id", pd.ComputeID)
|
||||
d.Set("description", pd.Description)
|
||||
d.Set("guid", pd.GUID)
|
||||
d.Set("hw_path", pd.HwPath)
|
||||
d.Set("device_id", pd.ID)
|
||||
d.Set("name", pd.Name)
|
||||
d.Set("rg_id", pd.RGID)
|
||||
d.Set("stack_id", pd.StackID)
|
||||
d.Set("status", pd.Status)
|
||||
d.Set("system_name", pd.SystemName)
|
||||
}
|
||||
|
||||
func flattenPcideviceList(pl *pcidevice.ListPCIDevices) []map[string]interface{} {
|
||||
log.Debug("flattenPCIDeviceList")
|
||||
|
||||
res := make([]map[string]interface{}, 0, len(pl.Data))
|
||||
for _, item := range pl.Data {
|
||||
temp := map[string]interface{}{
|
||||
"ckey": item.CKey,
|
||||
"meta": flattens.FlattenMeta(item.Meta),
|
||||
"compute_id": item.ComputeID,
|
||||
"description": item.Description,
|
||||
"guid": item.GUID,
|
||||
"hw_path": item.HwPath,
|
||||
"device_id": item.ID,
|
||||
"rg_id": item.RGID,
|
||||
"name": item.Name,
|
||||
"stack_id": item.StackID,
|
||||
"status": item.Status,
|
||||
"system_name": item.SystemName,
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
Reference in New Issue
Block a user