feat: support updated port profile API

This commit is contained in:
Mateusz Filipowicz
2025-01-22 00:15:06 +01:00
committed by Mateusz Filipowicz
parent 7e222cb061
commit 0cf84ee1df

View File

@@ -232,12 +232,11 @@ func resourcePortProfile() *schema.Resource {
Optional: true,
Default: true,
},
// TODO: renamed to tagged_network_ids
"tagged_networkconf_ids": {
Description: "The IDs of networks to tag traffic with for the port profile.",
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{Type: schema.TypeString},
"tagged_vlan_mgmt": {
Description: "The VLAN management type for the port profile. Can be one of 'auto', 'block_all', or 'custom'.",
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{"auto", "block_all", "custom"}, false),
},
// TODO: rename to voice_network_id
"voice_networkconf_id": {
@@ -277,11 +276,6 @@ func resourcePortProfileGetResourceData(d *schema.ResourceData) (*unifi.PortProf
return nil, err
}
taggedNetworkconfIds, err := setToStringSlice(d.Get("tagged_networkconf_ids").(*schema.Set))
if err != nil {
return nil, err
}
return &unifi.PortProfile{
Autoneg: d.Get("autoneg").(bool),
Dot1XCtrl: d.Get("dot1x_ctrl").(string),
@@ -315,7 +309,7 @@ func resourcePortProfileGetResourceData(d *schema.ResourceData) (*unifi.PortProf
StormctrlUcastLevel: d.Get("stormctrl_ucast_level").(int),
StormctrlUcastRate: d.Get("stormctrl_ucast_rate").(int),
StpPortMode: d.Get("stp_port_mode").(bool),
TaggedNetworkIDs: taggedNetworkconfIds,
TaggedVLANMgmt: d.Get("tagged_vlan_mgmt").(string),
VoiceNetworkID: d.Get("voice_networkconf_id").(string),
}, nil
}
@@ -354,7 +348,7 @@ func resourcePortProfileSetResourceData(resp *unifi.PortProfile, d *schema.Resou
d.Set("stormctrl_ucast_level", resp.StormctrlUcastLevel)
d.Set("stormctrl_ucast_rate", resp.StormctrlUcastRate)
d.Set("stp_port_mode", resp.StpPortMode)
d.Set("tagged_networkconf_ids", stringSliceToSet(resp.TaggedNetworkIDs))
d.Set("tagged_vlan_mgmt", resp.TaggedVLANMgmt)
d.Set("voice_networkconf_id", resp.VoiceNetworkID)
return nil