This commit is contained in:
2025-08-04 16:11:16 +03:00
parent bae25296bb
commit 4b3f21d9be
239 changed files with 6585 additions and 784 deletions

View File

@@ -230,6 +230,10 @@ func vnfInterfaceSchemaMake() map[string]*schema.Schema {
Schema: qosSchemaMake(),
},
},
"sdn_interface_id": {
Type: schema.TypeString,
Computed: true,
},
"target": {
Type: schema.TypeString,
Computed: true,
@@ -674,13 +678,6 @@ func gwSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
"routes": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: routesSchemaMake(),
},
},
"status": {
Type: schema.TypeString,
Computed: true,
@@ -813,13 +810,6 @@ func natSchemaMake() map[string]*schema.Schema {
Type: schema.TypeBool,
Computed: true,
},
"routes": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: routesSchemaMake(),
},
},
"status": {
Type: schema.TypeString,
Computed: true,
@@ -1008,6 +998,10 @@ func dataSourceVinsSchemaMake() map[string]*schema.Schema {
Type: schema.TypeInt,
Computed: true,
},
"zone_id": {
Type: schema.TypeInt,
Computed: true,
},
}
return rets
}

View File

@@ -105,6 +105,7 @@ func flattenInterfaces(interfaces []vins.ItemVNFInterface) []map[string]interfac
"pci_slot": vnfInterface.PCISlot,
"bus_number": vnfInterface.BusNumber,
"qos": flattenQOS(vnfInterface.QOS),
"sdn_interface_id": vnfInterface.SDNInterfaceID,
"target": vnfInterface.Target,
"type": vnfInterface.Type,
"vnfs": vnfInterface.VNFs,
@@ -284,7 +285,6 @@ func flattenGW(gw vins.RecordGW) []map[string]interface{} {
"owner_id": gw.OwnerID,
"owner_type": gw.OwnerType,
"pure_virtual": gw.PureVirtual,
"routes": flattenStaticRoute(gw.Routes),
"status": gw.Status,
"tech_status": gw.TechStatus,
"type": gw.Type,
@@ -341,7 +341,6 @@ func flattenNAT(nat vins.RecordNAT) []map[string]interface{} {
"owner_id": nat.OwnerID,
"owner_type": nat.OwnerType,
"pure_virtual": nat.PureVirtual,
"routes": flattenStaticRoute(nat.Routes),
"status": nat.Status,
"tech_status": nat.TechStatus,
"type": nat.Type,
@@ -413,6 +412,7 @@ func flattenVins(d *schema.ResourceData, vins *vins.RecordVINS) {
d.Set("vnfs", flattenVNFS(vins.VNFs))
d.Set("vxlan_id", vins.VXLANID)
d.Set("nat_rule", flattenRuleBlock(vins.VNFs.NAT.Config.Rules))
d.Set("zone_id", vins.ZoneID)
}
func flattenVinsData(d *schema.ResourceData, vins *vins.RecordVINS) {
@@ -448,6 +448,7 @@ func flattenVinsData(d *schema.ResourceData, vins *vins.RecordVINS) {
d.Set("user_managed", vins.UserManaged)
d.Set("vnfs", flattenVNFS(vins.VNFs))
d.Set("vxlan_id", vins.VXLANID)
d.Set("zone_id", vins.ZoneID)
}
func flattenVinsAudits(audits vins.ListAudits) []map[string]interface{} {

View File

@@ -140,6 +140,10 @@ func resourceVinsCreate(ctx context.Context, d *schema.ResourceData, m interface
}
}
if zoneID, ok := d.GetOk("zone_id"); ok {
req.ZoneID = uint64(zoneID.(int))
}
id, err := c.CloudAPI().VINS().CreateInRG(ctx, req)
if err != nil {
d.SetId("")
@@ -173,6 +177,10 @@ func resourceVinsCreate(ctx context.Context, d *schema.ResourceData, m interface
}
}
if zoneID, ok := d.GetOk("zone_id"); ok {
req.ZoneID = uint64(zoneID.(int))
}
id, err := c.CloudAPI().VINS().CreateInAccount(ctx, req)
if err != nil {
d.SetId("")
@@ -676,6 +684,21 @@ func resourceVinsUpdate(ctx context.Context, d *schema.ResourceData, m interface
}
}
}
if d.HasChange("zone_id") {
zoneID := uint64(d.Get("zone_id").(int))
req := vins.MigrateToZoneRequest{
VINSID: vinsData.ID,
ZoneID: zoneID,
}
_, err := c.CloudAPI().VINS().MigrateToZone(ctx, req)
if err != nil {
warnings.Add(err)
}
}
return append(warnings.Get(), resourceVinsRead(ctx, d, m)...)
}
@@ -879,6 +902,12 @@ func resourceVinsSchemaMake() map[string]*schema.Schema {
Computed: true,
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
}
rets["zone_id"] = &schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
Description: "ID of the Zone to put ViNS into",
}
return rets
}