diff --git a/gen/templates/model.go b/gen/templates/model.go index 94053426..d80d00d1 100644 --- a/gen/templates/model.go +++ b/gen/templates/model.go @@ -157,7 +157,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N body, _ = sjson.Set(body, "{{getFullModelName . true}}", values) } {{- else if isNestedListSetMap .}} - {{if not .Mandatory}}if len(data.{{toGoName .TfName}}) > 0 {{end}}{ + {{if not .Mandatory}}if data.{{toGoName .TfName}} != nil {{end}}{ {{- if isNestedMap .}} body, _ = sjson.Set(body, "{{getFullModelName . true}}", map[string]interface{}{}) for key, item := range data.{{toGoName .TfName}} { @@ -182,7 +182,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N itemBody, _ = sjson.Set(itemBody, "{{getFullModelName . true}}", values) } {{- else if isNestedListSetMap .}} - {{if not .Mandatory}}if len(item.{{toGoName .TfName}}) > 0 {{end}}{ + {{if not .Mandatory}}if item.{{toGoName .TfName}} != nil {{end}}{ {{- if isNestedMap .}} itemBody, _ = sjson.Set(itemBody, "{{getFullModelName . true}}", map[string]interface{}{}) for key, childItem := range item.{{toGoName .TfName}} { @@ -207,7 +207,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N itemChildBody, _ = sjson.Set(itemChildBody, "{{getFullModelName . true}}", values) } {{- else if isNestedListSetMap .}} - {{if not .Mandatory}}if len(childItem.{{toGoName .TfName}}) > 0 {{end}}{ + {{if not .Mandatory}}if childItem.{{toGoName .TfName}} != nil {{end}}{ {{- if isNestedMap .}} itemChildBody, _ = sjson.Set(itemChildBody, "{{getFullModelName . true}}", map[string]interface{}{}) for key, childChildItem := range childItem.{{toGoName .TfName}} { diff --git a/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go b/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go index 21e6696b..4417d510 100644 --- a/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go +++ b/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go @@ -86,7 +86,7 @@ func (data ApplianceOneToOneNATRules) toBody(ctx context.Context, state Applianc if !item.Uplink.IsNull() { itemBody, _ = sjson.Set(itemBody, "uplink", item.Uplink.ValueString()) } - if len(item.AllowedInbound) > 0 { + if item.AllowedInbound != nil { itemBody, _ = sjson.Set(itemBody, "allowedInbound", []interface{}{}) for _, childItem := range item.AllowedInbound { itemChildBody := "" diff --git a/internal/provider/model_meraki_appliance_sdwan_internet_policies.go b/internal/provider/model_meraki_appliance_sdwan_internet_policies.go index ddc6db63..317fc7d1 100644 --- a/internal/provider/model_meraki_appliance_sdwan_internet_policies.go +++ b/internal/provider/model_meraki_appliance_sdwan_internet_policies.go @@ -117,7 +117,7 @@ func (data ApplianceSDWANInternetPolicies) toBody(ctx context.Context, state App if !childItem.DestinationPort.IsNull() { itemChildBody, _ = sjson.Set(itemChildBody, "value.destination.port", childItem.DestinationPort.ValueString()) } - if len(childItem.DestinationApplications) > 0 { + if childItem.DestinationApplications != nil { itemChildBody, _ = sjson.Set(itemChildBody, "value.destination.applications", []interface{}{}) for _, childChildItem := range childItem.DestinationApplications { itemChildChildBody := "" diff --git a/internal/provider/model_meraki_appliance_security_malware.go b/internal/provider/model_meraki_appliance_security_malware.go index cbb42f8c..da5efb86 100644 --- a/internal/provider/model_meraki_appliance_security_malware.go +++ b/internal/provider/model_meraki_appliance_security_malware.go @@ -70,7 +70,7 @@ func (data ApplianceSecurityMalware) toBody(ctx context.Context, state Appliance if !data.Mode.IsNull() { body, _ = sjson.Set(body, "mode", data.Mode.ValueString()) } - if len(data.AllowedFiles) > 0 { + if data.AllowedFiles != nil { body, _ = sjson.Set(body, "allowedFiles", []interface{}{}) for _, item := range data.AllowedFiles { itemBody := "" @@ -83,7 +83,7 @@ func (data ApplianceSecurityMalware) toBody(ctx context.Context, state Appliance body, _ = sjson.SetRaw(body, "allowedFiles.-1", itemBody) } } - if len(data.AllowedUrls) > 0 { + if data.AllowedUrls != nil { body, _ = sjson.Set(body, "allowedUrls", []interface{}{}) for _, item := range data.AllowedUrls { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_single_lan.go b/internal/provider/model_meraki_appliance_single_lan.go index 1adc92db..737d0fcf 100644 --- a/internal/provider/model_meraki_appliance_single_lan.go +++ b/internal/provider/model_meraki_appliance_single_lan.go @@ -76,7 +76,7 @@ func (data ApplianceSingleLAN) toBody(ctx context.Context, state ApplianceSingle if !data.Ipv6Enabled.IsNull() { body, _ = sjson.Set(body, "ipv6.enabled", data.Ipv6Enabled.ValueBool()) } - if len(data.Ipv6PrefixAssignments) > 0 { + if data.Ipv6PrefixAssignments != nil { body, _ = sjson.Set(body, "ipv6.prefixAssignments", []interface{}{}) for _, item := range data.Ipv6PrefixAssignments { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_site_to_site_vpn.go b/internal/provider/model_meraki_appliance_site_to_site_vpn.go index 22b6ff05..d6b203a2 100644 --- a/internal/provider/model_meraki_appliance_site_to_site_vpn.go +++ b/internal/provider/model_meraki_appliance_site_to_site_vpn.go @@ -76,7 +76,7 @@ func (data ApplianceSiteToSiteVPN) toBody(ctx context.Context, state ApplianceSi if !data.SubnetNatIsAllowed.IsNull() { body, _ = sjson.Set(body, "subnet.nat.isAllowed", data.SubnetNatIsAllowed.ValueBool()) } - if len(data.Hubs) > 0 { + if data.Hubs != nil { body, _ = sjson.Set(body, "hubs", []interface{}{}) for _, item := range data.Hubs { itemBody := "" @@ -89,7 +89,7 @@ func (data ApplianceSiteToSiteVPN) toBody(ctx context.Context, state ApplianceSi body, _ = sjson.SetRaw(body, "hubs.-1", itemBody) } } - if len(data.Subnets) > 0 { + if data.Subnets != nil { body, _ = sjson.Set(body, "subnets", []interface{}{}) for _, item := range data.Subnets { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_ssid.go b/internal/provider/model_meraki_appliance_ssid.go index 9acac370..5164207d 100644 --- a/internal/provider/model_meraki_appliance_ssid.go +++ b/internal/provider/model_meraki_appliance_ssid.go @@ -105,7 +105,7 @@ func (data ApplianceSSID) toBody(ctx context.Context, state ApplianceSSID) strin if !data.Dot11wRequired.IsNull() { body, _ = sjson.Set(body, "dot11w.required", data.Dot11wRequired.ValueBool()) } - if len(data.RadiusServers) > 0 { + if data.RadiusServers != nil { body, _ = sjson.Set(body, "radiusServers", []interface{}{}) for _, item := range data.RadiusServers { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_rules.go b/internal/provider/model_meraki_appliance_traffic_shaping_rules.go index 1db512db..31ba11be 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_rules.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_rules.go @@ -70,7 +70,7 @@ func (data ApplianceTrafficShapingRules) toBody(ctx context.Context, state Appli if !data.DefaultRulesEnabled.IsNull() { body, _ = sjson.Set(body, "defaultRulesEnabled", data.DefaultRulesEnabled.ValueBool()) } - if len(data.Rules) > 0 { + if data.Rules != nil { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go index ac8c7ffc..c6e67b81 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go @@ -114,7 +114,7 @@ func (data ApplianceTrafficShapingUplinkSelection) toBody(ctx context.Context, s if !data.FailoverAndFailbackImmediateEnabled.IsNull() { body, _ = sjson.Set(body, "failoverAndFailback.immediate.enabled", data.FailoverAndFailbackImmediateEnabled.ValueBool()) } - if len(data.VpnTrafficUplinkPreferences) > 0 { + if data.VpnTrafficUplinkPreferences != nil { body, _ = sjson.Set(body, "vpnTrafficUplinkPreferences", []interface{}{}) for _, item := range data.VpnTrafficUplinkPreferences { itemBody := "" @@ -185,7 +185,7 @@ func (data ApplianceTrafficShapingUplinkSelection) toBody(ctx context.Context, s body, _ = sjson.SetRaw(body, "vpnTrafficUplinkPreferences.-1", itemBody) } } - if len(data.WanTrafficUplinkPreferences) > 0 { + if data.WanTrafficUplinkPreferences != nil { body, _ = sjson.Set(body, "wanTrafficUplinkPreferences", []interface{}{}) for _, item := range data.WanTrafficUplinkPreferences { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go index a96c92b6..f831717a 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -67,7 +67,7 @@ func (data ApplianceTrafficShapingVPNExclusions) getPath() string { func (data ApplianceTrafficShapingVPNExclusions) toBody(ctx context.Context, state ApplianceTrafficShapingVPNExclusions) string { body := "" - if len(data.Custom) > 0 { + if data.Custom != nil { body, _ = sjson.Set(body, "custom", []interface{}{}) for _, item := range data.Custom { itemBody := "" @@ -83,7 +83,7 @@ func (data ApplianceTrafficShapingVPNExclusions) toBody(ctx context.Context, sta body, _ = sjson.SetRaw(body, "custom.-1", itemBody) } } - if len(data.MajorApplications) > 0 { + if data.MajorApplications != nil { body, _ = sjson.Set(body, "majorApplications", []interface{}{}) for _, item := range data.MajorApplications { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_vlan.go b/internal/provider/model_meraki_appliance_vlan.go index ba3e8f05..7575bf94 100644 --- a/internal/provider/model_meraki_appliance_vlan.go +++ b/internal/provider/model_meraki_appliance_vlan.go @@ -148,7 +148,7 @@ func (data ApplianceVLAN) toBody(ctx context.Context, state ApplianceVLAN) strin if !data.VpnNatSubnet.IsNull() { body, _ = sjson.Set(body, "vpnNatSubnet", data.VpnNatSubnet.ValueString()) } - if len(data.FixedIpAssignments) > 0 { + if data.FixedIpAssignments != nil { body, _ = sjson.Set(body, "fixedIpAssignments", map[string]interface{}{}) for key, item := range data.FixedIpAssignments { itemBody := "" @@ -164,7 +164,7 @@ func (data ApplianceVLAN) toBody(ctx context.Context, state ApplianceVLAN) strin if !data.Ipv6Enabled.IsNull() { body, _ = sjson.Set(body, "ipv6.enabled", data.Ipv6Enabled.ValueBool()) } - if len(data.Ipv6PrefixAssignments) > 0 { + if data.Ipv6PrefixAssignments != nil { body, _ = sjson.Set(body, "ipv6.prefixAssignments", []interface{}{}) for _, item := range data.Ipv6PrefixAssignments { itemBody := "" @@ -194,7 +194,7 @@ func (data ApplianceVLAN) toBody(ctx context.Context, state ApplianceVLAN) strin if !data.MandatoryDhcpEnabled.IsNull() { body, _ = sjson.Set(body, "mandatoryDhcp.enabled", data.MandatoryDhcpEnabled.ValueBool()) } - if len(data.DhcpOptions) > 0 { + if data.DhcpOptions != nil { body, _ = sjson.Set(body, "dhcpOptions", []interface{}{}) for _, item := range data.DhcpOptions { itemBody := "" @@ -215,7 +215,7 @@ func (data ApplianceVLAN) toBody(ctx context.Context, state ApplianceVLAN) strin data.DhcpRelayServerIps.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "dhcpRelayServerIps", values) } - if len(data.ReservedIpRanges) > 0 { + if data.ReservedIpRanges != nil { body, _ = sjson.Set(body, "reservedIpRanges", []interface{}{}) for _, item := range data.ReservedIpRanges { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_vlan_dhcp.go b/internal/provider/model_meraki_appliance_vlan_dhcp.go index 8f28d375..eb13ebb0 100644 --- a/internal/provider/model_meraki_appliance_vlan_dhcp.go +++ b/internal/provider/model_meraki_appliance_vlan_dhcp.go @@ -106,7 +106,7 @@ func (data ApplianceVLANDHCP) toBody(ctx context.Context, state ApplianceVLANDHC if !data.VpnNatSubnet.IsNull() { body, _ = sjson.Set(body, "vpnNatSubnet", data.VpnNatSubnet.ValueString()) } - if len(data.FixedIpAssignments) > 0 { + if data.FixedIpAssignments != nil { body, _ = sjson.Set(body, "fixedIpAssignments", map[string]interface{}{}) for key, item := range data.FixedIpAssignments { itemBody := "" @@ -122,7 +122,7 @@ func (data ApplianceVLANDHCP) toBody(ctx context.Context, state ApplianceVLANDHC if !data.MandatoryDhcpEnabled.IsNull() { body, _ = sjson.Set(body, "mandatoryDhcp.enabled", data.MandatoryDhcpEnabled.ValueBool()) } - if len(data.DhcpOptions) > 0 { + if data.DhcpOptions != nil { body, _ = sjson.Set(body, "dhcpOptions", []interface{}{}) for _, item := range data.DhcpOptions { itemBody := "" @@ -143,7 +143,7 @@ func (data ApplianceVLANDHCP) toBody(ctx context.Context, state ApplianceVLANDHC data.DhcpRelayServerIps.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "dhcpRelayServerIps", values) } - if len(data.ReservedIpRanges) > 0 { + if data.ReservedIpRanges != nil { body, _ = sjson.Set(body, "reservedIpRanges", []interface{}{}) for _, item := range data.ReservedIpRanges { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_vpn_bgp.go b/internal/provider/model_meraki_appliance_vpn_bgp.go index 7341da4b..f4efa288 100644 --- a/internal/provider/model_meraki_appliance_vpn_bgp.go +++ b/internal/provider/model_meraki_appliance_vpn_bgp.go @@ -85,7 +85,7 @@ func (data ApplianceVPNBGP) toBody(ctx context.Context, state ApplianceVPNBGP) s if !data.IbgpHoldTimer.IsNull() { body, _ = sjson.Set(body, "ibgpHoldTimer", data.IbgpHoldTimer.ValueInt64()) } - if len(data.Neighbors) > 0 { + if data.Neighbors != nil { body, _ = sjson.Set(body, "neighbors", []interface{}{}) for _, item := range data.Neighbors { itemBody := "" diff --git a/internal/provider/model_meraki_camera_custom_analytics.go b/internal/provider/model_meraki_camera_custom_analytics.go index e0082f7d..026453a6 100644 --- a/internal/provider/model_meraki_camera_custom_analytics.go +++ b/internal/provider/model_meraki_camera_custom_analytics.go @@ -68,7 +68,7 @@ func (data CameraCustomAnalytics) toBody(ctx context.Context, state CameraCustom if !data.Enabled.IsNull() { body, _ = sjson.Set(body, "enabled", data.Enabled.ValueBool()) } - if len(data.Parameters) > 0 { + if data.Parameters != nil { body, _ = sjson.Set(body, "parameters", []interface{}{}) for _, item := range data.Parameters { itemBody := "" diff --git a/internal/provider/model_meraki_camera_role.go b/internal/provider/model_meraki_camera_role.go index 30e28969..3eb24c41 100644 --- a/internal/provider/model_meraki_camera_role.go +++ b/internal/provider/model_meraki_camera_role.go @@ -79,7 +79,7 @@ func (data CameraRole) toBody(ctx context.Context, state CameraRole) string { if !data.Name.IsNull() { body, _ = sjson.Set(body, "name", data.Name.ValueString()) } - if len(data.AppliedOnDevices) > 0 { + if data.AppliedOnDevices != nil { body, _ = sjson.Set(body, "appliedOnDevices", []interface{}{}) for _, item := range data.AppliedOnDevices { itemBody := "" @@ -101,7 +101,7 @@ func (data CameraRole) toBody(ctx context.Context, state CameraRole) string { body, _ = sjson.SetRaw(body, "appliedOnDevices.-1", itemBody) } } - if len(data.AppliedOnNetworks) > 0 { + if data.AppliedOnNetworks != nil { body, _ = sjson.Set(body, "appliedOnNetworks", []interface{}{}) for _, item := range data.AppliedOnNetworks { itemBody := "" @@ -117,7 +117,7 @@ func (data CameraRole) toBody(ctx context.Context, state CameraRole) string { body, _ = sjson.SetRaw(body, "appliedOnNetworks.-1", itemBody) } } - if len(data.AppliedOrgWide) > 0 { + if data.AppliedOrgWide != nil { body, _ = sjson.Set(body, "appliedOrgWide", []interface{}{}) for _, item := range data.AppliedOrgWide { itemBody := "" diff --git a/internal/provider/model_meraki_device_cellular_sims.go b/internal/provider/model_meraki_device_cellular_sims.go index 50543647..bff44a22 100644 --- a/internal/provider/model_meraki_device_cellular_sims.go +++ b/internal/provider/model_meraki_device_cellular_sims.go @@ -85,7 +85,7 @@ func (data DeviceCellularSIMs) toBody(ctx context.Context, state DeviceCellularS data.SimOrdering.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "simOrdering", values) } - if len(data.Sims) > 0 { + if data.Sims != nil { body, _ = sjson.Set(body, "sims", []interface{}{}) for _, item := range data.Sims { itemBody := "" @@ -98,7 +98,7 @@ func (data DeviceCellularSIMs) toBody(ctx context.Context, state DeviceCellularS if !item.Slot.IsNull() { itemBody, _ = sjson.Set(itemBody, "slot", item.Slot.ValueString()) } - if len(item.Apns) > 0 { + if item.Apns != nil { itemBody, _ = sjson.Set(itemBody, "apns", []interface{}{}) for _, childItem := range item.Apns { itemChildBody := "" diff --git a/internal/provider/model_meraki_network_alerts_settings.go b/internal/provider/model_meraki_network_alerts_settings.go index 9f897c68..4b9b8b77 100644 --- a/internal/provider/model_meraki_network_alerts_settings.go +++ b/internal/provider/model_meraki_network_alerts_settings.go @@ -112,7 +112,7 @@ func (data NetworkAlertsSettings) toBody(ctx context.Context, state NetworkAlert if !data.MutingByPortSchedulesEnabled.IsNull() { body, _ = sjson.Set(body, "muting.byPortSchedules.enabled", data.MutingByPortSchedulesEnabled.ValueBool()) } - if len(data.Alerts) > 0 { + if data.Alerts != nil { body, _ = sjson.Set(body, "alerts", []interface{}{}) for _, item := range data.Alerts { itemBody := "" @@ -179,7 +179,7 @@ func (data NetworkAlertsSettings) toBody(ctx context.Context, state NetworkAlert if !item.FiltersTimeout.IsNull() { itemBody, _ = sjson.Set(itemBody, "filters.timeout", item.FiltersTimeout.ValueInt64()) } - if len(item.FiltersConditions) > 0 { + if item.FiltersConditions != nil { itemBody, _ = sjson.Set(itemBody, "filters.conditions", []interface{}{}) for _, childItem := range item.FiltersConditions { itemChildBody := "" diff --git a/internal/provider/model_meraki_network_device_claim.go b/internal/provider/model_meraki_network_device_claim.go index 6b2af465..dca10d23 100644 --- a/internal/provider/model_meraki_network_device_claim.go +++ b/internal/provider/model_meraki_network_device_claim.go @@ -75,7 +75,7 @@ func (data NetworkDeviceClaim) getDevicesPath() string { func (data NetworkDeviceClaim) toBody(ctx context.Context, state NetworkDeviceClaim) string { body := "" - if len(data.DetailsByDevice) > 0 { + if data.DetailsByDevice != nil { body, _ = sjson.Set(body, "detailsByDevice", []interface{}{}) for _, item := range data.DetailsByDevice { itemBody := "" diff --git a/internal/provider/model_meraki_network_group_policy.go b/internal/provider/model_meraki_network_group_policy.go index f96b9d70..05f6cc05 100644 --- a/internal/provider/model_meraki_network_group_policy.go +++ b/internal/provider/model_meraki_network_group_policy.go @@ -147,7 +147,7 @@ func (data NetworkGroupPolicy) toBody(ctx context.Context, state NetworkGroupPol if !data.BonjourForwardingSettings.IsNull() { body, _ = sjson.Set(body, "bonjourForwarding.settings", data.BonjourForwardingSettings.ValueString()) } - if len(data.BonjourForwardingRules) > 0 { + if data.BonjourForwardingRules != nil { body, _ = sjson.Set(body, "bonjourForwarding.rules", []interface{}{}) for _, item := range data.BonjourForwardingRules { itemBody := "" @@ -192,7 +192,7 @@ func (data NetworkGroupPolicy) toBody(ctx context.Context, state NetworkGroupPol if !data.FirewallAndTrafficShapingSettings.IsNull() { body, _ = sjson.Set(body, "firewallAndTrafficShaping.settings", data.FirewallAndTrafficShapingSettings.ValueString()) } - if len(data.L3FirewallRules) > 0 { + if data.L3FirewallRules != nil { body, _ = sjson.Set(body, "firewallAndTrafficShaping.l3FirewallRules", []interface{}{}) for _, item := range data.L3FirewallRules { itemBody := "" @@ -214,7 +214,7 @@ func (data NetworkGroupPolicy) toBody(ctx context.Context, state NetworkGroupPol body, _ = sjson.SetRaw(body, "firewallAndTrafficShaping.l3FirewallRules.-1", itemBody) } } - if len(data.L7FirewallRules) > 0 { + if data.L7FirewallRules != nil { body, _ = sjson.Set(body, "firewallAndTrafficShaping.l7FirewallRules", []interface{}{}) for _, item := range data.L7FirewallRules { itemBody := "" @@ -236,7 +236,7 @@ func (data NetworkGroupPolicy) toBody(ctx context.Context, state NetworkGroupPol body, _ = sjson.SetRaw(body, "firewallAndTrafficShaping.l7FirewallRules.-1", itemBody) } } - if len(data.TrafficShapingRules) > 0 { + if data.TrafficShapingRules != nil { body, _ = sjson.Set(body, "firewallAndTrafficShaping.trafficShapingRules", []interface{}{}) for _, item := range data.TrafficShapingRules { itemBody := "" diff --git a/internal/provider/model_meraki_network_snmp.go b/internal/provider/model_meraki_network_snmp.go index 17d11b0a..7e8c3f2e 100644 --- a/internal/provider/model_meraki_network_snmp.go +++ b/internal/provider/model_meraki_network_snmp.go @@ -68,7 +68,7 @@ func (data NetworkSNMP) toBody(ctx context.Context, state NetworkSNMP) string { if !data.CommunityString.IsNull() { body, _ = sjson.Set(body, "communityString", data.CommunityString.ValueString()) } - if len(data.Users) > 0 { + if data.Users != nil { body, _ = sjson.Set(body, "users", []interface{}{}) for _, item := range data.Users { itemBody := "" diff --git a/internal/provider/model_meraki_network_traffic_analysis.go b/internal/provider/model_meraki_network_traffic_analysis.go index 0ff0a10e..a609291e 100644 --- a/internal/provider/model_meraki_network_traffic_analysis.go +++ b/internal/provider/model_meraki_network_traffic_analysis.go @@ -65,7 +65,7 @@ func (data NetworkTrafficAnalysis) toBody(ctx context.Context, state NetworkTraf if !data.Mode.IsNull() { body, _ = sjson.Set(body, "mode", data.Mode.ValueString()) } - if len(data.CustomPieChartItems) > 0 { + if data.CustomPieChartItems != nil { body, _ = sjson.Set(body, "customPieChartItems", []interface{}{}) for _, item := range data.CustomPieChartItems { itemBody := "" diff --git a/internal/provider/model_meraki_network_webhook_payload_template.go b/internal/provider/model_meraki_network_webhook_payload_template.go index 13c6041e..75eaae1d 100644 --- a/internal/provider/model_meraki_network_webhook_payload_template.go +++ b/internal/provider/model_meraki_network_webhook_payload_template.go @@ -76,7 +76,7 @@ func (data NetworkWebhookPayloadTemplate) toBody(ctx context.Context, state Netw if !data.Name.IsNull() { body, _ = sjson.Set(body, "name", data.Name.ValueString()) } - if len(data.Headers) > 0 { + if data.Headers != nil { body, _ = sjson.Set(body, "headers", []interface{}{}) for _, item := range data.Headers { itemBody := "" diff --git a/internal/provider/model_meraki_organization.go b/internal/provider/model_meraki_organization.go index c07cf393..2d8ec754 100644 --- a/internal/provider/model_meraki_organization.go +++ b/internal/provider/model_meraki_organization.go @@ -62,7 +62,7 @@ func (data Organization) toBody(ctx context.Context, state Organization) string if !data.Name.IsNull() { body, _ = sjson.Set(body, "name", data.Name.ValueString()) } - if len(data.ManagementDetails) > 0 { + if data.ManagementDetails != nil { body, _ = sjson.Set(body, "management.details", []interface{}{}) for _, item := range data.ManagementDetails { itemBody := "" diff --git a/internal/provider/model_meraki_organization_adaptive_policy.go b/internal/provider/model_meraki_organization_adaptive_policy.go index 2b7679ad..d0db09c0 100644 --- a/internal/provider/model_meraki_organization_adaptive_policy.go +++ b/internal/provider/model_meraki_organization_adaptive_policy.go @@ -87,7 +87,7 @@ func (data OrganizationAdaptivePolicy) toBody(ctx context.Context, state Organiz if !data.SourceGroupSgt.IsNull() { body, _ = sjson.Set(body, "sourceGroup.sgt", data.SourceGroupSgt.ValueInt64()) } - if len(data.Acls) > 0 { + if data.Acls != nil { body, _ = sjson.Set(body, "acls", []interface{}{}) for _, item := range data.Acls { itemBody := "" diff --git a/internal/provider/model_meraki_organization_adaptive_policy_group.go b/internal/provider/model_meraki_organization_adaptive_policy_group.go index f6761dac..b53365d9 100644 --- a/internal/provider/model_meraki_organization_adaptive_policy_group.go +++ b/internal/provider/model_meraki_organization_adaptive_policy_group.go @@ -72,7 +72,7 @@ func (data OrganizationAdaptivePolicyGroup) toBody(ctx context.Context, state Or if !data.Sgt.IsNull() { body, _ = sjson.Set(body, "sgt", data.Sgt.ValueInt64()) } - if len(data.PolicyObjects) > 0 { + if data.PolicyObjects != nil { body, _ = sjson.Set(body, "policyObjects", []interface{}{}) for _, item := range data.PolicyObjects { itemBody := "" diff --git a/internal/provider/model_meraki_organization_admin.go b/internal/provider/model_meraki_organization_admin.go index ae711855..046c4a59 100644 --- a/internal/provider/model_meraki_organization_admin.go +++ b/internal/provider/model_meraki_organization_admin.go @@ -82,7 +82,7 @@ func (data OrganizationAdmin) toBody(ctx context.Context, state OrganizationAdmi if !data.OrgAccess.IsNull() { body, _ = sjson.Set(body, "orgAccess", data.OrgAccess.ValueString()) } - if len(data.Networks) > 0 { + if data.Networks != nil { body, _ = sjson.Set(body, "networks", []interface{}{}) for _, item := range data.Networks { itemBody := "" @@ -95,7 +95,7 @@ func (data OrganizationAdmin) toBody(ctx context.Context, state OrganizationAdmi body, _ = sjson.SetRaw(body, "networks.-1", itemBody) } } - if len(data.Tags) > 0 { + if data.Tags != nil { body, _ = sjson.Set(body, "tags", []interface{}{}) for _, item := range data.Tags { itemBody := "" diff --git a/internal/provider/model_meraki_organization_inventory_claim.go b/internal/provider/model_meraki_organization_inventory_claim.go index aa4f5db3..15b7f351 100644 --- a/internal/provider/model_meraki_organization_inventory_claim.go +++ b/internal/provider/model_meraki_organization_inventory_claim.go @@ -71,7 +71,7 @@ func (data OrganizationInventoryClaim) getDevicesPath() string { func (data OrganizationInventoryClaim) toBody(ctx context.Context, state OrganizationInventoryClaim) string { body := "" - if len(data.Licenses) > 0 { + if data.Licenses != nil { body, _ = sjson.Set(body, "licenses", []interface{}{}) for _, item := range data.Licenses { itemBody := "" diff --git a/internal/provider/model_meraki_organization_saml_role.go b/internal/provider/model_meraki_organization_saml_role.go index 8b69dc80..7ec912d8 100644 --- a/internal/provider/model_meraki_organization_saml_role.go +++ b/internal/provider/model_meraki_organization_saml_role.go @@ -74,7 +74,7 @@ func (data OrganizationSAMLRole) toBody(ctx context.Context, state OrganizationS if !data.Role.IsNull() { body, _ = sjson.Set(body, "role", data.Role.ValueString()) } - if len(data.Networks) > 0 { + if data.Networks != nil { body, _ = sjson.Set(body, "networks", []interface{}{}) for _, item := range data.Networks { itemBody := "" @@ -87,7 +87,7 @@ func (data OrganizationSAMLRole) toBody(ctx context.Context, state OrganizationS body, _ = sjson.SetRaw(body, "networks.-1", itemBody) } } - if len(data.Tags) > 0 { + if data.Tags != nil { body, _ = sjson.Set(body, "tags", []interface{}{}) for _, item := range data.Tags { itemBody := "" diff --git a/internal/provider/model_meraki_sensor_relationships.go b/internal/provider/model_meraki_sensor_relationships.go index 9fa1917a..3924f8b2 100644 --- a/internal/provider/model_meraki_sensor_relationships.go +++ b/internal/provider/model_meraki_sensor_relationships.go @@ -59,7 +59,7 @@ func (data SensorRelationships) getPath() string { func (data SensorRelationships) toBody(ctx context.Context, state SensorRelationships) string { body := "" - if len(data.LivestreamRelatedDevices) > 0 { + if data.LivestreamRelatedDevices != nil { body, _ = sjson.Set(body, "livestream.relatedDevices", []interface{}{}) for _, item := range data.LivestreamRelatedDevices { itemBody := "" diff --git a/internal/provider/model_meraki_switch_access_policy.go b/internal/provider/model_meraki_switch_access_policy.go index ca402bcc..c1cc62b4 100644 --- a/internal/provider/model_meraki_switch_access_policy.go +++ b/internal/provider/model_meraki_switch_access_policy.go @@ -191,7 +191,7 @@ func (data SwitchAccessPolicy) toBody(ctx context.Context, state SwitchAccessPol if !data.RadiusCriticalAuthVoiceVlanId.IsNull() { body, _ = sjson.Set(body, "radius.criticalAuth.voiceVlanId", data.RadiusCriticalAuthVoiceVlanId.ValueInt64()) } - if len(data.RadiusAccountingServers) > 0 { + if data.RadiusAccountingServers != nil { body, _ = sjson.Set(body, "radiusAccountingServers", []interface{}{}) for _, item := range data.RadiusAccountingServers { itemBody := "" diff --git a/internal/provider/model_meraki_switch_alternate_management_interface.go b/internal/provider/model_meraki_switch_alternate_management_interface.go index edb5ae41..40da1593 100644 --- a/internal/provider/model_meraki_switch_alternate_management_interface.go +++ b/internal/provider/model_meraki_switch_alternate_management_interface.go @@ -76,7 +76,7 @@ func (data SwitchAlternateManagementInterface) toBody(ctx context.Context, state data.Protocols.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "protocols", values) } - if len(data.Switches) > 0 { + if data.Switches != nil { body, _ = sjson.Set(body, "switches", []interface{}{}) for _, item := range data.Switches { itemBody := "" diff --git a/internal/provider/model_meraki_switch_link_aggregation.go b/internal/provider/model_meraki_switch_link_aggregation.go index 1c15fc52..d171da7b 100644 --- a/internal/provider/model_meraki_switch_link_aggregation.go +++ b/internal/provider/model_meraki_switch_link_aggregation.go @@ -66,7 +66,7 @@ func (data SwitchLinkAggregation) getPath() string { func (data SwitchLinkAggregation) toBody(ctx context.Context, state SwitchLinkAggregation) string { body := "" - if len(data.SwitchPorts) > 0 { + if data.SwitchPorts != nil { body, _ = sjson.Set(body, "switchPorts", []interface{}{}) for _, item := range data.SwitchPorts { itemBody := "" @@ -79,7 +79,7 @@ func (data SwitchLinkAggregation) toBody(ctx context.Context, state SwitchLinkAg body, _ = sjson.SetRaw(body, "switchPorts.-1", itemBody) } } - if len(data.SwitchProfilePorts) > 0 { + if data.SwitchProfilePorts != nil { body, _ = sjson.Set(body, "switchProfilePorts", []interface{}{}) for _, item := range data.SwitchProfilePorts { itemBody := "" diff --git a/internal/provider/model_meraki_switch_mtu.go b/internal/provider/model_meraki_switch_mtu.go index a5d22c83..e312d8f7 100644 --- a/internal/provider/model_meraki_switch_mtu.go +++ b/internal/provider/model_meraki_switch_mtu.go @@ -65,7 +65,7 @@ func (data SwitchMTU) toBody(ctx context.Context, state SwitchMTU) string { if !data.DefaultMtuSize.IsNull() { body, _ = sjson.Set(body, "defaultMtuSize", data.DefaultMtuSize.ValueInt64()) } - if len(data.Overrides) > 0 { + if data.Overrides != nil { body, _ = sjson.Set(body, "overrides", []interface{}{}) for _, item := range data.Overrides { itemBody := "" diff --git a/internal/provider/model_meraki_switch_organization_ports_profile.go b/internal/provider/model_meraki_switch_organization_ports_profile.go index 2d389f3e..bb65a124 100644 --- a/internal/provider/model_meraki_switch_organization_ports_profile.go +++ b/internal/provider/model_meraki_switch_organization_ports_profile.go @@ -101,7 +101,7 @@ func (data SwitchOrganizationPortsProfile) toBody(ctx context.Context, state Swi if !data.NetworksType.IsNull() { body, _ = sjson.Set(body, "networks.type", data.NetworksType.ValueString()) } - if len(data.NetworksValues) > 0 { + if data.NetworksValues != nil { body, _ = sjson.Set(body, "networks.values", []interface{}{}) for _, item := range data.NetworksValues { itemBody := "" diff --git a/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go b/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go index 9db97666..09eaf0b3 100644 --- a/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go +++ b/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go @@ -91,7 +91,7 @@ func (data SwitchOrganizationPortsProfilesAutomation) toBody(ctx context.Context if !data.FallbackProfileName.IsNull() { body, _ = sjson.Set(body, "fallbackProfile.name", data.FallbackProfileName.ValueString()) } - if len(data.AssignedSwitchPorts) > 0 { + if data.AssignedSwitchPorts != nil { body, _ = sjson.Set(body, "assignedSwitchPorts", []interface{}{}) for _, item := range data.AssignedSwitchPorts { itemBody := "" diff --git a/internal/provider/model_meraki_switch_routing_interface_dhcp.go b/internal/provider/model_meraki_switch_routing_interface_dhcp.go index 9bd1a787..c62c2a24 100644 --- a/internal/provider/model_meraki_switch_routing_interface_dhcp.go +++ b/internal/provider/model_meraki_switch_routing_interface_dhcp.go @@ -103,7 +103,7 @@ func (data SwitchRoutingInterfaceDHCP) toBody(ctx context.Context, state SwitchR if !data.DnsNameserversOption.IsNull() { body, _ = sjson.Set(body, "dnsNameserversOption", data.DnsNameserversOption.ValueString()) } - if len(data.DhcpOptions) > 0 { + if data.DhcpOptions != nil { body, _ = sjson.Set(body, "dhcpOptions", []interface{}{}) for _, item := range data.DhcpOptions { itemBody := "" @@ -129,7 +129,7 @@ func (data SwitchRoutingInterfaceDHCP) toBody(ctx context.Context, state SwitchR data.DnsCustomNameservers.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "dnsCustomNameservers", values) } - if len(data.FixedIpAssignments) > 0 { + if data.FixedIpAssignments != nil { body, _ = sjson.Set(body, "fixedIpAssignments", []interface{}{}) for _, item := range data.FixedIpAssignments { itemBody := "" @@ -145,7 +145,7 @@ func (data SwitchRoutingInterfaceDHCP) toBody(ctx context.Context, state SwitchR body, _ = sjson.SetRaw(body, "fixedIpAssignments.-1", itemBody) } } - if len(data.ReservedIpRanges) > 0 { + if data.ReservedIpRanges != nil { body, _ = sjson.Set(body, "reservedIpRanges", []interface{}{}) for _, item := range data.ReservedIpRanges { itemBody := "" diff --git a/internal/provider/model_meraki_switch_routing_multicast.go b/internal/provider/model_meraki_switch_routing_multicast.go index f5d42ed7..b960ca5a 100644 --- a/internal/provider/model_meraki_switch_routing_multicast.go +++ b/internal/provider/model_meraki_switch_routing_multicast.go @@ -73,7 +73,7 @@ func (data SwitchRoutingMulticast) toBody(ctx context.Context, state SwitchRouti if !data.DefaultSettingsIgmpSnoopingEnabled.IsNull() { body, _ = sjson.Set(body, "defaultSettings.igmpSnoopingEnabled", data.DefaultSettingsIgmpSnoopingEnabled.ValueBool()) } - if len(data.Overrides) > 0 { + if data.Overrides != nil { body, _ = sjson.Set(body, "overrides", []interface{}{}) for _, item := range data.Overrides { itemBody := "" diff --git a/internal/provider/model_meraki_switch_routing_ospf.go b/internal/provider/model_meraki_switch_routing_ospf.go index 0942362e..97f8f5dc 100644 --- a/internal/provider/model_meraki_switch_routing_ospf.go +++ b/internal/provider/model_meraki_switch_routing_ospf.go @@ -104,7 +104,7 @@ func (data SwitchRoutingOSPF) toBody(ctx context.Context, state SwitchRoutingOSP if !data.V3HelloTimerInSeconds.IsNull() { body, _ = sjson.Set(body, "v3.helloTimerInSeconds", data.V3HelloTimerInSeconds.ValueInt64()) } - if len(data.V3Areas) > 0 { + if data.V3Areas != nil { body, _ = sjson.Set(body, "v3.areas", []interface{}{}) for _, item := range data.V3Areas { itemBody := "" @@ -120,7 +120,7 @@ func (data SwitchRoutingOSPF) toBody(ctx context.Context, state SwitchRoutingOSP body, _ = sjson.SetRaw(body, "v3.areas.-1", itemBody) } } - if len(data.Areas) > 0 { + if data.Areas != nil { body, _ = sjson.Set(body, "areas", []interface{}{}) for _, item := range data.Areas { itemBody := "" diff --git a/internal/provider/model_meraki_switch_settings.go b/internal/provider/model_meraki_switch_settings.go index d3b620cf..3b09da08 100644 --- a/internal/provider/model_meraki_switch_settings.go +++ b/internal/provider/model_meraki_switch_settings.go @@ -76,7 +76,7 @@ func (data SwitchSettings) toBody(ctx context.Context, state SwitchSettings) str if !data.UplinkClientSamplingEnabled.IsNull() { body, _ = sjson.Set(body, "uplinkClientSampling.enabled", data.UplinkClientSamplingEnabled.ValueBool()) } - if len(data.PowerExceptions) > 0 { + if data.PowerExceptions != nil { body, _ = sjson.Set(body, "powerExceptions", []interface{}{}) for _, item := range data.PowerExceptions { itemBody := "" diff --git a/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go b/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go index d5c686ee..e9bbe252 100644 --- a/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go +++ b/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go @@ -104,7 +104,7 @@ func (data SwitchStackRoutingInterfaceDHCP) toBody(ctx context.Context, state Sw if !data.DnsNameserversOption.IsNull() { body, _ = sjson.Set(body, "dnsNameserversOption", data.DnsNameserversOption.ValueString()) } - if len(data.DhcpOptions) > 0 { + if data.DhcpOptions != nil { body, _ = sjson.Set(body, "dhcpOptions", []interface{}{}) for _, item := range data.DhcpOptions { itemBody := "" @@ -130,7 +130,7 @@ func (data SwitchStackRoutingInterfaceDHCP) toBody(ctx context.Context, state Sw data.DnsCustomNameservers.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "dnsCustomNameservers", values) } - if len(data.FixedIpAssignments) > 0 { + if data.FixedIpAssignments != nil { body, _ = sjson.Set(body, "fixedIpAssignments", []interface{}{}) for _, item := range data.FixedIpAssignments { itemBody := "" @@ -146,7 +146,7 @@ func (data SwitchStackRoutingInterfaceDHCP) toBody(ctx context.Context, state Sw body, _ = sjson.SetRaw(body, "fixedIpAssignments.-1", itemBody) } } - if len(data.ReservedIpRanges) > 0 { + if data.ReservedIpRanges != nil { body, _ = sjson.Set(body, "reservedIpRanges", []interface{}{}) for _, item := range data.ReservedIpRanges { itemBody := "" diff --git a/internal/provider/model_meraki_switch_stp.go b/internal/provider/model_meraki_switch_stp.go index befb5be0..7cf2816f 100644 --- a/internal/provider/model_meraki_switch_stp.go +++ b/internal/provider/model_meraki_switch_stp.go @@ -68,7 +68,7 @@ func (data SwitchSTP) toBody(ctx context.Context, state SwitchSTP) string { if !data.RstpEnabled.IsNull() { body, _ = sjson.Set(body, "rstpEnabled", data.RstpEnabled.ValueBool()) } - if len(data.StpBridgePriority) > 0 { + if data.StpBridgePriority != nil { body, _ = sjson.Set(body, "stpBridgePriority", []interface{}{}) for _, item := range data.StpBridgePriority { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_alternate_management_interface.go b/internal/provider/model_meraki_wireless_alternate_management_interface.go index 680e547c..4fbb21df 100644 --- a/internal/provider/model_meraki_wireless_alternate_management_interface.go +++ b/internal/provider/model_meraki_wireless_alternate_management_interface.go @@ -74,7 +74,7 @@ func (data WirelessAlternateManagementInterface) toBody(ctx context.Context, sta if !data.VlanId.IsNull() { body, _ = sjson.Set(body, "vlanId", data.VlanId.ValueInt64()) } - if len(data.AccessPoints) > 0 { + if data.AccessPoints != nil { body, _ = sjson.Set(body, "accessPoints", []interface{}{}) for _, item := range data.AccessPoints { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_billing.go b/internal/provider/model_meraki_wireless_billing.go index 26afe684..4a732d57 100644 --- a/internal/provider/model_meraki_wireless_billing.go +++ b/internal/provider/model_meraki_wireless_billing.go @@ -65,7 +65,7 @@ func (data WirelessBilling) toBody(ctx context.Context, state WirelessBilling) s if !data.Currency.IsNull() { body, _ = sjson.Set(body, "currency", data.Currency.ValueString()) } - if len(data.Plans) > 0 { + if data.Plans != nil { body, _ = sjson.Set(body, "plans", []interface{}{}) for _, item := range data.Plans { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ethernet_port_profile.go b/internal/provider/model_meraki_wireless_ethernet_port_profile.go index c5553784..b375012e 100644 --- a/internal/provider/model_meraki_wireless_ethernet_port_profile.go +++ b/internal/provider/model_meraki_wireless_ethernet_port_profile.go @@ -92,7 +92,7 @@ func (data WirelessEthernetPortProfile) toBody(ctx context.Context, state Wirele body, _ = sjson.SetRaw(body, "ports.-1", itemBody) } } - if len(data.UsbPorts) > 0 { + if data.UsbPorts != nil { body, _ = sjson.Set(body, "usbPorts", []interface{}{}) for _, item := range data.UsbPorts { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_rf_profile.go b/internal/provider/model_meraki_wireless_rf_profile.go index b0927536..f7dc7a2e 100644 --- a/internal/provider/model_meraki_wireless_rf_profile.go +++ b/internal/provider/model_meraki_wireless_rf_profile.go @@ -190,7 +190,7 @@ func (data WirelessRFProfile) toBody(ctx context.Context, state WirelessRFProfil data.FiveGhzSettingsValidAutoChannels.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "fiveGhzSettings.validAutoChannels", values) } - if len(data.FlexRadiosByModel) > 0 { + if data.FlexRadiosByModel != nil { body, _ = sjson.Set(body, "flexRadios.byModel", []interface{}{}) for _, item := range data.FlexRadiosByModel { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid.go b/internal/provider/model_meraki_wireless_ssid.go index 1e75383b..652f005a 100644 --- a/internal/provider/model_meraki_wireless_ssid.go +++ b/internal/provider/model_meraki_wireless_ssid.go @@ -322,7 +322,7 @@ func (data WirelessSSID) toBody(ctx context.Context, state WirelessSSID) string if !data.ActiveDirectoryCredentialsPassword.IsNull() { body, _ = sjson.Set(body, "activeDirectory.credentials.password", data.ActiveDirectoryCredentialsPassword.ValueString()) } - if len(data.ActiveDirectoryServers) > 0 { + if data.ActiveDirectoryServers != nil { body, _ = sjson.Set(body, "activeDirectory.servers", []interface{}{}) for _, item := range data.ActiveDirectoryServers { itemBody := "" @@ -373,7 +373,7 @@ func (data WirelessSSID) toBody(ctx context.Context, state WirelessSSID) string if !data.LdapServerCaCertificateContents.IsNull() { body, _ = sjson.Set(body, "ldap.serverCaCertificate.contents", data.LdapServerCaCertificateContents.ValueString()) } - if len(data.LdapServers) > 0 { + if data.LdapServers != nil { body, _ = sjson.Set(body, "ldap.servers", []interface{}{}) for _, item := range data.LdapServers { itemBody := "" @@ -428,7 +428,7 @@ func (data WirelessSSID) toBody(ctx context.Context, state WirelessSSID) string if !data.NamedVlansTaggingEnabled.IsNull() { body, _ = sjson.Set(body, "namedVlans.tagging.enabled", data.NamedVlansTaggingEnabled.ValueBool()) } - if len(data.NamedVlansTaggingByApTags) > 0 { + if data.NamedVlansTaggingByApTags != nil { body, _ = sjson.Set(body, "namedVlans.tagging.byApTags", []interface{}{}) for _, item := range data.NamedVlansTaggingByApTags { itemBody := "" @@ -454,7 +454,7 @@ func (data WirelessSSID) toBody(ctx context.Context, state WirelessSSID) string if !data.SpeedBurstEnabled.IsNull() { body, _ = sjson.Set(body, "speedBurst.enabled", data.SpeedBurstEnabled.ValueBool()) } - if len(data.ApTagsAndVlanIds) > 0 { + if data.ApTagsAndVlanIds != nil { body, _ = sjson.Set(body, "apTagsAndVlanIds", []interface{}{}) for _, item := range data.ApTagsAndVlanIds { itemBody := "" @@ -474,7 +474,7 @@ func (data WirelessSSID) toBody(ctx context.Context, state WirelessSSID) string data.AvailabilityTags.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "availabilityTags", values) } - if len(data.RadiusAccountingServers) > 0 { + if data.RadiusAccountingServers != nil { body, _ = sjson.Set(body, "radiusAccountingServers", []interface{}{}) for _, item := range data.RadiusAccountingServers { itemBody := "" @@ -496,7 +496,7 @@ func (data WirelessSSID) toBody(ctx context.Context, state WirelessSSID) string body, _ = sjson.SetRaw(body, "radiusAccountingServers.-1", itemBody) } } - if len(data.RadiusServers) > 0 { + if data.RadiusServers != nil { body, _ = sjson.Set(body, "radiusServers", []interface{}{}) for _, item := range data.RadiusServers { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go b/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go index 0533ad0d..96c31849 100644 --- a/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go +++ b/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go @@ -71,7 +71,7 @@ func (data WirelessSSIDBonjourForwarding) toBody(ctx context.Context, state Wire if !data.ExceptionEnabled.IsNull() { body, _ = sjson.Set(body, "exception.enabled", data.ExceptionEnabled.ValueBool()) } - if len(data.Rules) > 0 { + if data.Rules != nil { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go b/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go index 8cd55384..87ea5f3a 100644 --- a/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go +++ b/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go @@ -66,7 +66,7 @@ func (data WirelessSSIDDeviceTypeGroupPolicies) toBody(ctx context.Context, stat if !data.Enabled.IsNull() { body, _ = sjson.Set(body, "enabled", data.Enabled.ValueBool()) } - if len(data.DeviceTypePolicies) > 0 { + if data.DeviceTypePolicies != nil { body, _ = sjson.Set(body, "deviceTypePolicies", []interface{}{}) for _, item := range data.DeviceTypePolicies { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_hotspot_20.go b/internal/provider/model_meraki_wireless_ssid_hotspot_20.go index 32c218f5..d1e165b9 100644 --- a/internal/provider/model_meraki_wireless_ssid_hotspot_20.go +++ b/internal/provider/model_meraki_wireless_ssid_hotspot_20.go @@ -104,7 +104,7 @@ func (data WirelessSSIDHotspot20) toBody(ctx context.Context, state WirelessSSID data.Domains.ElementsAs(ctx, &values, false) body, _ = sjson.Set(body, "domains", values) } - if len(data.MccMncs) > 0 { + if data.MccMncs != nil { body, _ = sjson.Set(body, "mccMncs", []interface{}{}) for _, item := range data.MccMncs { itemBody := "" @@ -117,7 +117,7 @@ func (data WirelessSSIDHotspot20) toBody(ctx context.Context, state WirelessSSID body, _ = sjson.SetRaw(body, "mccMncs.-1", itemBody) } } - if len(data.NaiRealms) > 0 { + if data.NaiRealms != nil { body, _ = sjson.Set(body, "naiRealms", []interface{}{}) for _, item := range data.NaiRealms { itemBody := "" @@ -127,7 +127,7 @@ func (data WirelessSSIDHotspot20) toBody(ctx context.Context, state WirelessSSID if !item.Realm.IsNull() { itemBody, _ = sjson.Set(itemBody, "realm", item.Realm.ValueString()) } - if len(item.Methods) > 0 { + if item.Methods != nil { itemBody, _ = sjson.Set(itemBody, "methods", []interface{}{}) for _, childItem := range item.Methods { itemChildBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go b/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go index c42433f7..ff26490a 100644 --- a/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go @@ -68,7 +68,7 @@ func (data WirelessSSIDL3FirewallRules) toBody(ctx context.Context, state Wirele if !data.AllowLanAccess.IsNull() { body, _ = sjson.Set(body, "allowLanAccess", data.AllowLanAccess.ValueBool()) } - if len(data.Rules) > 0 { + if data.Rules != nil { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go b/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go index 6156b87f..451fd479 100644 --- a/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go @@ -58,7 +58,7 @@ func (data WirelessSSIDL7FirewallRules) getPath() string { // End of section. //template:end getPath func (data WirelessSSIDL7FirewallRules) toBody(ctx context.Context, state WirelessSSIDL7FirewallRules) string { body := "" - if len(data.Rules) > 0 { + if data.Rules != nil { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_schedules.go b/internal/provider/model_meraki_wireless_ssid_schedules.go index 2299329e..bd507008 100644 --- a/internal/provider/model_meraki_wireless_ssid_schedules.go +++ b/internal/provider/model_meraki_wireless_ssid_schedules.go @@ -74,7 +74,7 @@ func (data WirelessSSIDSchedules) toBody(ctx context.Context, state WirelessSSID if !data.Enabled.IsNull() { body, _ = sjson.Set(body, "enabled", data.Enabled.ValueBool()) } - if len(data.Ranges) > 0 { + if data.Ranges != nil { body, _ = sjson.Set(body, "ranges", []interface{}{}) for _, item := range data.Ranges { itemBody := "" @@ -93,7 +93,7 @@ func (data WirelessSSIDSchedules) toBody(ctx context.Context, state WirelessSSID body, _ = sjson.SetRaw(body, "ranges.-1", itemBody) } } - if len(data.RangesInSeconds) > 0 { + if data.RangesInSeconds != nil { body, _ = sjson.Set(body, "rangesInSeconds", []interface{}{}) for _, item := range data.RangesInSeconds { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go b/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go index c279627e..755c5b53 100644 --- a/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go @@ -75,7 +75,7 @@ func (data WirelessSSIDTrafficShapingRules) toBody(ctx context.Context, state Wi if !data.TrafficShapingEnabled.IsNull() { body, _ = sjson.Set(body, "trafficShapingEnabled", data.TrafficShapingEnabled.ValueBool()) } - if len(data.Rules) > 0 { + if data.Rules != nil { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_vpn.go b/internal/provider/model_meraki_wireless_ssid_vpn.go index 8c031018..d22e3626 100644 --- a/internal/provider/model_meraki_wireless_ssid_vpn.go +++ b/internal/provider/model_meraki_wireless_ssid_vpn.go @@ -87,7 +87,7 @@ func (data WirelessSSIDVPN) toBody(ctx context.Context, state WirelessSSIDVPN) s if !data.SplitTunnelEnabled.IsNull() { body, _ = sjson.Set(body, "splitTunnel.enabled", data.SplitTunnelEnabled.ValueBool()) } - if len(data.SplitTunnelRules) > 0 { + if data.SplitTunnelRules != nil { body, _ = sjson.Set(body, "splitTunnel.rules", []interface{}{}) for _, item := range data.SplitTunnelRules { itemBody := ""