You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform-provider-decort/internal/service/cloudapi/dpdknet/flattens.go

45 lines
1.3 KiB

package dpdknet
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
dpdk "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/dpdknet"
)
func flattenDPDKNet(d *schema.ResourceData, dpdk *dpdk.RecordDPDKNet) {
d.Set("dpdk_id", dpdk.ID)
d.Set("account_access", dpdk.AccountAccess)
d.Set("created_time", dpdk.CreatedTime)
d.Set("desc", dpdk.Description)
d.Set("gid", dpdk.GID)
d.Set("guid", dpdk.GUID)
d.Set("name", dpdk.Name)
d.Set("rg_access", dpdk.RGAccess)
d.Set("status", dpdk.Status)
d.Set("ovs_bridge", dpdk.OVSBridge)
d.Set("vlan_id", dpdk.VlanID)
d.Set("compute_ids", dpdk.ComputeIDs)
d.Set("updated_time", dpdk.UpdatedTime)
}
func flattenDPDKNetList(list *dpdk.ListDPDKNet) []map[string]interface{} {
res := make([]map[string]interface{}, 0, len(list.Data))
for _, dpdk := range list.Data {
temp := map[string]interface{}{
"dpdk_id": dpdk.ID,
"account_access": dpdk.AccountAccess,
"desc": dpdk.Description,
"gid": dpdk.GID,
"guid": dpdk.GUID,
"name": dpdk.Name,
"rg_access": dpdk.RGAccess,
"status": dpdk.Status,
"ovs_bridge": dpdk.OVSBridge,
"vlan_id": dpdk.VlanID,
"compute_ids": dpdk.ComputeIDs,
"updated_time": dpdk.UpdatedTime,
}
res = append(res, temp)
}
return res
}