4.12.0
This commit is contained in:
@@ -14,11 +14,13 @@ func flattenSegment(d *schema.ResourceData, segmentRecord *segments.SegmentRespo
|
||||
d.Set("dhcp_v6", flattenDHCPv6(segmentRecord.DHCPv6))
|
||||
d.Set("display_name", segmentRecord.DisplayName)
|
||||
d.Set("enabled", segmentRecord.Enabled)
|
||||
d.Set("l2_connection_port", flattenL2ConnectionPort(segmentRecord.L2ConnectionPort))
|
||||
d.Set("logical_ports_info", flattenEntity(segmentRecord.LogicalPortsInfo))
|
||||
d.Set("routers_info", flattenEntity(segmentRecord.RoutersInfo))
|
||||
d.Set("status", flattenStatus(segmentRecord.Status))
|
||||
d.Set("subnet_v4", segmentRecord.SubnetV4)
|
||||
d.Set("subnet_v6", segmentRecord.SubnetV6)
|
||||
d.Set("type", segmentRecord.Type)
|
||||
d.Set("updated_at", segmentRecord.UpdatedAt.String())
|
||||
d.Set("version_id", segmentRecord.VersionID)
|
||||
}
|
||||
@@ -26,8 +28,8 @@ func flattenSegment(d *schema.ResourceData, segmentRecord *segments.SegmentRespo
|
||||
func flattenStatus(s segments.Status) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"common": s.Common,
|
||||
"hypervisors": flattenHypervisors(s.Hypervisors),
|
||||
"operation_status": s.OperationStatus,
|
||||
"hypervisors": flattenHypervisors(s.Hypervisors),
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
@@ -37,7 +39,7 @@ func flattenHypervisors(hv []segments.HypervisorStatus) []map[string]interface{}
|
||||
res := make([]map[string]interface{}, 0, len(hv))
|
||||
for _, v := range hv {
|
||||
temp := map[string]interface{}{
|
||||
"status": v.Status,
|
||||
"operation_status": v.OperationStatus,
|
||||
"name": v.Name,
|
||||
"display_name": v.DisplayName,
|
||||
"hypervisor_status": v.HypervisorStatus,
|
||||
@@ -90,6 +92,42 @@ func flattenDHCPv6(dchp segments.DHCPv6Config) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenL2ExternalNetwork(net segments.L2ExternalNetwork) []map[string]interface{} {
|
||||
return []map[string]interface{}{
|
||||
{
|
||||
"id": net.ID,
|
||||
"display_name": net.DisplayName,
|
||||
"description": net.Description,
|
||||
"bridge_network_name": net.BridgeNetworkName,
|
||||
"hypervisors": net.Hypervisors,
|
||||
"vlan_tag": net.VLANTag,
|
||||
"version_id": net.VersionID,
|
||||
"created_at": net.CreatedAt.String(),
|
||||
"created_by": net.CreatedBy,
|
||||
"updated_at": net.UpdatedAt.String(),
|
||||
"updated_by": net.UpdatedBy,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func flattenL2ConnectionPort(port *segments.L2ConnectionPort) []map[string]interface{} {
|
||||
if port == nil {
|
||||
return nil
|
||||
}
|
||||
return []map[string]interface{}{
|
||||
{
|
||||
"id": port.ID,
|
||||
"access_group_id": port.AccessGroupID,
|
||||
"version_id": port.VersionID,
|
||||
"created_at": port.CreatedAt.String(),
|
||||
"created_by": port.CreatedBy,
|
||||
"updated_at": port.UpdatedAt.String(),
|
||||
"updated_by": port.UpdatedBy,
|
||||
"l2_external_network": flattenL2ExternalNetwork(port.L2ExternalNetwork),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func flattenSegmentList(sl *segments.ListSegment) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(*sl))
|
||||
for _, v := range *sl {
|
||||
@@ -102,12 +140,14 @@ func flattenSegmentList(sl *segments.ListSegment) []map[string]interface{} {
|
||||
"dhcp_v6": flattenDHCPv6(v.DHCPv6),
|
||||
"display_name": v.DisplayName,
|
||||
"enabled": v.Enabled,
|
||||
"l2_connection_port": flattenL2ConnectionPort(v.L2ConnectionPort),
|
||||
"logical_ports_info": flattenEntity(v.LogicalPortsInfo),
|
||||
"routers_info": flattenEntity(v.RoutersInfo),
|
||||
"status": flattenStatus(v.Status),
|
||||
"id": v.ID,
|
||||
"subnet_v4": v.SubnetV4,
|
||||
"subnet_v6": v.SubnetV6,
|
||||
"type": v.Type,
|
||||
"updated_at": v.UpdatedAt.String(),
|
||||
"version_id": v.VersionID,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user