Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gen/templates/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}} {
Expand All @@ -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}} {
Expand All @@ -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}} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/model_meraki_appliance_security_malware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_appliance_single_lan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/model_meraki_appliance_site_to_site_vpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_appliance_ssid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/model_meraki_appliance_vlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/model_meraki_appliance_vlan_dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_appliance_vpn_bgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_camera_custom_analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/model_meraki_camera_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/model_meraki_device_cellular_sims.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/model_meraki_network_alerts_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down Expand Up @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_network_device_claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
8 changes: 4 additions & 4 deletions internal/provider/model_meraki_network_group_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down Expand Up @@ -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 := ""
Expand All @@ -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 := ""
Expand All @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_network_snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_network_traffic_analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/model_meraki_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 := ""
Expand Down
Loading