Skip to content

Commit

Permalink
fix: Simplify the procedure for generating field conversion lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaerh committed Mar 22, 2024
1 parent dfacfb2 commit a67b772
Show file tree
Hide file tree
Showing 22 changed files with 107 additions and 101 deletions.
12 changes: 2 additions & 10 deletions routeros/mikrotik_serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

var reMetadataFields = regexp.MustCompile(`^___\S+___$`)
var reTransformSet = regexp.MustCompile(`"\s*?(\S+?)\s*?"\s*?:\s*?"\s*?(\S+?)\s*?"`)
var reTransformSet = regexp.MustCompile(`"\s*?(\S+?)\s*?\s*?:\s*?\s*?(\S+?)\s*?"`)
var reSkipFields = regexp.MustCompile(`"\s*?(\S+?)\s*?"\s*?`)

// GetMetadata Get item metadata fields from resource schema.
Expand Down Expand Up @@ -97,14 +97,6 @@ func loadSkipFields(s string) (m map[string]struct{}) {
return
}

func loadDropByValue(s string) (m map[string]struct{}) {
m = make(map[string]struct{})
for _, value := range strings.Split(s, ",") {
m[value] = struct{}{}
}
return m
}

// ListToString Convert List and Set to a delimited string.
func ListToString(v any) (res string) {
for i, elem := range v.([]interface{}) {
Expand Down Expand Up @@ -314,7 +306,7 @@ func MikrotikResourceDataToTerraform(item MikrotikItem, s map[string]*schema.Sch
}

if dbv, ok := s[MetaDropByValue]; ok {
dropByValue = loadDropByValue(dbv.Default.(string))
dropByValue = loadSkipFields(dbv.Default.(string))
}

// TypeMap,TypeSet initialization information storage.
Expand Down
29 changes: 25 additions & 4 deletions routeros/mikrotik_serialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ func Test_loadTransformSet(t *testing.T) {
s string
reverse bool
}{
{`"channel":"channel.config","datapath":"datapath.config"`, false},
{`"mikrotik-field-name":"schema-field-name"`, false},
{`"channel":"channel.config","datapath":"datapath.config"`, true},
{`"mikrotik-field-name":"schema-field-name"`, true},
{toQuotedCommaSeparatedString("channel: channel.config","datapath: datapath.config"), false},
{toQuotedCommaSeparatedString("mikrotik-field-name : schema-field-name"), false},
{toQuotedCommaSeparatedString("channel: channel.config","datapath: datapath.config"), true},
{toQuotedCommaSeparatedString("mikrotik-field-name:schema-field-name"), true},
}

expected := []map[string]string{
Expand All @@ -149,3 +149,24 @@ func Test_loadTransformSet(t *testing.T) {
}
}
}

func Test_loadSkipFields(t *testing.T) {
testData := []struct {
s string
}{
{toQuotedCommaSeparatedString("name")},
{toQuotedCommaSeparatedString("name", "rx_1024_1518", "rx_128_255", "rx_1519_max", "rx_256_511", "rx_512_1023", "rx_64")},
}

expected := []map[string]struct{}{
{"name": struct{}{}},
{"name": struct{}{}, "rx_1024_1518": struct{}{}, "rx_128_255": struct{}{}, "rx_1519_max": struct{}{},
"rx_256_511": struct{}{}, "rx_512_1023": struct{}{}, "rx_64": struct{}{}},
}

for i, actual := range testData {
if !reflect.DeepEqual(loadSkipFields(actual.s), expected[i]) {
t.Fatalf("bad: (item: %v) expected:%#v\tactual:%#v", i, expected[i], loadSkipFields(actual.s))
}
}
}
49 changes: 20 additions & 29 deletions routeros/provider_schema_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,23 @@ func PropId(t IdType) *schema.Schema {
}
}

func PropDropByValue(values ...string) *schema.Schema {
func toQuotedCommaSeparatedString(s ...string) string {
builder := strings.Builder{}
const singleQuote = `"`
const commaSingleQuote = `,"`
builder.WriteString(singleQuote + s[0] + singleQuote)

for i := 1; i < len(s); i++ {
builder.WriteString(commaSingleQuote + s[i] + singleQuote)
}
return builder.String()
}

func PropDropByValue(s ...string) *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: strings.Join(values, ","),
Default: toQuotedCommaSeparatedString(s...),
Description: "<em>A list of values when generated by RouterOs will be dropped, useful to default values as 'unspecified' for null</em>",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return true
Expand All @@ -93,11 +105,11 @@ func PropDropByValue(values ...string) *schema.Schema {
}

// PropTransformSet
func PropTransformSet(s string) *schema.Schema {
func PropTransformSet(s ...string) *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: s,
Default: toQuotedCommaSeparatedString(s...),
Description: "<em>A set of transformations for field names. This is an internal service field, setting a value is not required.</em>",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return true
Expand All @@ -106,45 +118,24 @@ func PropTransformSet(s string) *schema.Schema {
}

// PropSkipFields
func PropSkipFields(s string) *schema.Schema {
func PropSkipFields(s ...string) *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: s,
Default: toQuotedCommaSeparatedString(s...),
Description: "<em>A set of transformations for field names. This is an internal service field, setting a value is not required.</em>",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return true
},
}
}

// PropSkipFieldsSlice creates the metadata field of Mikrotik items to be ignored. This means
// that responses from the router with those fields will be silently ignored.
func PropSkipFieldsSlice(s ...string) *schema.Schema {
if len(s) == 0 {
panic(fmt.Errorf("provider error, can't creat skip properties without properties"))
}
return PropSkipFields(toQuotedCommaSeparatedString(s...))
}

func toQuotedCommaSeparatedString(s ...string) string {
builder := strings.Builder{}
const singleQuote = "\""
const commaSingleQuote = ",\""
builder.WriteString(singleQuote + s[0] + singleQuote)

for i := 1; i < len(s); i++ {
builder.WriteString(commaSingleQuote + s[i] + singleQuote)
}
return builder.String()
}

// PropSetUnsetFields
func PropSetUnsetFields(s string) *schema.Schema {
func PropSetUnsetFields(s ...string) *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: s,
Default: toQuotedCommaSeparatedString(s...),
Description: "<em>A set of fields that require setting/unsetting. This is an internal service field, setting a value is not required.</em>",
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return true
Expand Down
4 changes: 2 additions & 2 deletions routeros/resource_capsman_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func ResourceCapsManConfiguration() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/caps-man/configuration"),
MetaId: PropId(Id),
MetaTransformSet: PropTransformSet(`"channel": "channel.config", "datapath": "datapath.config",
"rates": "rates.config", "security": "security.config"`),
MetaTransformSet: PropTransformSet("channel: channel.config", "datapath: datapath.config",
"rates: rates.config", "security: security.config"),

"channel": {
Type: schema.TypeMap,
Expand Down
4 changes: 2 additions & 2 deletions routeros/resource_capsman_configuration_v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ func ResourceCapsManConfigurationV0() *schema.Resource {
Schema: map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/caps-man/configuration"),
MetaId: PropId(Name),
MetaTransformSet: PropTransformSet(`"channel": "channel.config", "datapath": "datapath.config",
"rates": "rates.config", "security": "security.config"`),
MetaTransformSet: PropTransformSet("channel: channel.config", "datapath: datapath.config",
"rates: rates.config", "security: security.config"),

"channel": {
Type: schema.TypeMap,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_interface_bridge_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ResourceInterfaceBridgePort() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/interface/bridge/port"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"debug_info","port_number"`),
MetaSkipFields: PropSkipFields("debug_info", "port_number"),

"nextid": {
Type: schema.TypeString,
Expand Down
19 changes: 9 additions & 10 deletions routeros/resource_interface_ethernet.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ func ResourceInterfaceEthernet() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/interface/ethernet"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(
`"factory_name","driver_rx_byte","driver_rx_packet","driver_tx_byte","driver_tx_packet",` +
`"rx_64","rx_65_127","rx_128_255","rx_256_511","rx_512_1023","rx_1024_1518","rx_1519_max",` +
`"tx_64","tx_65_127","tx_128_255","tx_256_511","tx_512_1023","tx_1024_1518","tx_1519_max",` +
`"tx_rx_64","tx_rx_65_127","tx_rx_128_255","tx_rx_256_511","tx_rx_512_1023","tx_rx_1024_1518","tx_rx_1024_max",tx_rx_1519_max",` +
`"rx_broadcast","rx_bytes","rx_control","rx_drop","rx_fcs_error","rx_fragment","rx_jabber","rx_multicast","rx_packet","rx_pause","rx_too_short","rx_too_long",` +
`"tx_broadcast","tx_bytes","tx_control","tx_drop","tx_fcs_error","tx_fragment","tx_jabber","tx_multicast","tx_packet","tx_pause","tx_too_short","tx_too_long",` +
`"rx_align_error","rx_carrier_error","rx_code_error","rx_error_events","rx_length_error","rx_overflow","rx_unicast","rx_unknown_op"` +
`"tx_collision","tx_excessive_collision","tx_late_collision","tx_multiple_collision","tx_single_collision","tx_total_collision",` +
`"tx_deferred","tx_excessive_deferred","tx_unicast","tx_underrun"`,
MetaSkipFields: PropSkipFields("factory_name", "driver_rx_byte", "driver_rx_packet", "driver_tx_byte", "driver_tx_packet",
"rx_64", "rx_65_127", "rx_128_255", "rx_256_511", "rx_512_1023", "rx_1024_1518", "rx_1519_max",
"tx_64", "tx_65_127", "tx_128_255", "tx_256_511", "tx_512_1023", "tx_1024_1518", "tx_1519_max",
"tx_rx_64", "tx_rx_65_127", "tx_rx_128_255", "tx_rx_256_511", "tx_rx_512_1023", "tx_rx_1024_1518", "tx_rx_1024_max", "tx_rx_1519_max",
"rx_broadcast", "rx_bytes", "rx_control", "rx_drop", "rx_fcs_error", "rx_fragment", "rx_jabber", "rx_multicast", "rx_packet", "rx_pause", "rx_too_short", "rx_too_long",
"tx_broadcast", "tx_bytes", "tx_control", "tx_drop", "tx_fcs_error", "tx_fragment", "tx_jabber", "tx_multicast", "tx_packet", "tx_pause", "tx_too_short", "tx_too_long",
"rx_align_error", "rx_carrier_error", "rx_code_error", "rx_error_events", "rx_length_error", "rx_overflow", "rx_unicast", "rx_unknown_op",
"tx_collision", "tx_excessive_collision", "tx_late_collision", "tx_multiple_collision", "tx_single_collision", "tx_total_collision",
"tx_deferred", "tx_excessive_deferred", "tx_unicast", "tx_underrun",
),

"advertise": {
Expand Down
16 changes: 8 additions & 8 deletions routeros/resource_interface_ethernet_switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ func ResourceInterfaceEthernetSwitch() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/interface/ethernet/switch"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"switch_id","driver_rx_byte","driver_rx_packet","driver_tx_byte","driver_tx_packet",` +
`"rx_align_error","rx_broadcast","rx_bytes","rx_carrier_error","rx_code_error","rx_control","rx_drop",` +
`"rx_fcs_error","rx_fragment","rx_jabber","rx_length_error","rx_multicast","rx_packet","rx_pause",` +
`"rx_too_long","rx_too_short","rx_unknown_op","tx_broadcast","tx_bytes","tx_control","tx_deferred",` +
`"tx_drop","tx_excessive_collision","tx_excessive_deferred","tx_fcs_error","tx_fragment","tx_jabber",` +
`"tx_late_collision","tx_multicast","tx_multiple_collision","tx_packet","tx_pause","tx_rx_1024_1518",` +
`"tx_rx_128_255","tx_rx_1519_max","tx_rx_256_511","tx_rx_512_1023","tx_rx_64","tx_rx_65_127",` +
`"tx_single_collision","tx_too_long","tx_too_short","tx_total_collision"`),
MetaSkipFields: PropSkipFields("switch_id", "driver_rx_byte", "driver_rx_packet", "driver_tx_byte", "driver_tx_packet",
"rx_align_error", "rx_broadcast", "rx_bytes", "rx_carrier_error", "rx_code_error", "rx_control", "rx_drop",
"rx_fcs_error", "rx_fragment", "rx_jabber", "rx_length_error", "rx_multicast", "rx_packet", "rx_pause",
"rx_too_long", "rx_too_short", "rx_unknown_op", "tx_broadcast", "tx_bytes", "tx_control", "tx_deferred",
"tx_drop", "tx_excessive_collision", "tx_excessive_deferred", "tx_fcs_error", "tx_fragment", "tx_jabber",
"tx_late_collision", "tx_multicast", "tx_multiple_collision", "tx_packet", "tx_pause", "tx_rx_1024_1518",
"tx_rx_128_255", "tx_rx_1519_max", "tx_rx_256_511", "tx_rx_512_1023", "tx_rx_64", "tx_rx_65_127",
"tx_single_collision", "tx_too_long", "tx_too_short", "tx_total_collision"),

"cpu_flow_control": {
Type: schema.TypeBool,
Expand Down
12 changes: 6 additions & 6 deletions routeros/resource_interface_ethernet_switch_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ func ResourceInterfaceEthernetSwitchPort() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/interface/ethernet/switch/port"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"name","rx_1024_1518","rx_128_255","rx_1519_max","rx_256_511","rx_512_1023","rx_64",` +
`"rx_65_127","rx_align_error","rx_broadcast","rx_bytes","rx_fcs_error","rx_fragment","rx_multicast","rx_overflow",` +
`"rx_pause","rx_too_long","rx_too_short","tx_1024_1518","tx_128_255","tx_1519_max","tx_256_511","tx_512_1023","tx_64",` +
`"tx_65_127","tx_broadcast","tx_bytes","tx_collision","tx_deferred","tx_excessive_collision","tx_excessive_deferred",` +
`"tx_late_collision","tx_multicast","tx_multiple_collision","tx_pause","tx_single_collision","tx_too_long","tx_underrun",` +
`"driver_tx_byte","driver_rx_packet","driver_rx_byte","driver_tx_packet"`),
MetaSkipFields: PropSkipFields("name", "rx_1024_1518", "rx_128_255", "rx_1519_max", "rx_256_511", "rx_512_1023", "rx_64",
"rx_65_127", "rx_align_error", "rx_broadcast", "rx_bytes", "rx_fcs_error", "rx_fragment", "rx_multicast", "rx_overflow",
"rx_pause", "rx_too_long", "rx_too_short", "tx_1024_1518", "tx_128_255", "tx_1519_max", "tx_256_511", "tx_512_1023", "tx_64",
"tx_65_127", "tx_broadcast", "tx_bytes", "tx_collision", "tx_deferred", "tx_excessive_collision", "tx_excessive_deferred",
"tx_late_collision", "tx_multicast", "tx_multiple_collision", "tx_pause", "tx_single_collision", "tx_too_long", "tx_underrun",
"driver_tx_byte", "driver_rx_packet", "driver_rx_byte", "driver_tx_packet"),

"default_vlan_id": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions routeros/resource_interface_ethernet_switch_port_isolation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func ResourceInterfaceEthernetSwitchPortIsolation() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/interface/ethernet/switch/port-isolation"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"name"`),
MetaSetUnsetFields: PropSetUnsetFields(`"forwarding_override"`),
MetaSkipFields: PropSkipFields("name"),
MetaSetUnsetFields: PropSetUnsetFields("forwarding_override"),

KeyInvalid: PropInvalidRo,
KeyName: PropName("Port name."),
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_ip_firewall_connection_tracking.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func ResourceIPConnectionTracking() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/ip/firewall/connection/tracking"),
MetaId: PropId(Name),
MetaSkipFields: PropSkipFields(`"total_entries"`),
MetaSkipFields: PropSkipFields("total_entries"),

"active_ipv4": {
Type: schema.TypeBool,
Expand Down
9 changes: 5 additions & 4 deletions routeros/resource_ip_firewall_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import (
// ResourceIPFirewallFilter https://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Filter
func ResourceIPFirewallFilter() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/ip/firewall/filter"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"bytes","packets"`),
MetaSetUnsetFields: PropSetUnsetFields(`"dst_address_list","src_address_list","in_interface_list","out_interface_list","in_bridge_port_list","out_bridge_port_list"`),
MetaResourcePath: PropResourcePath("/ip/firewall/filter"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields("bytes", "packets"),
MetaSetUnsetFields: PropSetUnsetFields("dst_address_list", "src_address_list", "in_interface_list",
"out_interface_list", "in_bridge_port_list", "out_bridge_port_list"),

"action": {
Type: schema.TypeString,
Expand Down
9 changes: 5 additions & 4 deletions routeros/resource_ip_firewall_mangle.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import (
// ResourceIPFirewallMangle https://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Mangle
func ResourceIPFirewallMangle() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/ip/firewall/mangle"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"bytes","packets"`),
MetaSetUnsetFields: PropSetUnsetFields(`"dst_address_list","src_address_list","in_interface_list","out_interface_list","in_bridge_port_list","out_bridge_port_list"`),
MetaResourcePath: PropResourcePath("/ip/firewall/mangle"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields("bytes", "packets"),
MetaSetUnsetFields: PropSetUnsetFields("dst_address_list", "src_address_list", "in_interface_list",
"out_interface_list", "in_bridge_port_list", "out_bridge_port_list"),

"action": {
Type: schema.TypeString,
Expand Down
9 changes: 5 additions & 4 deletions routeros/resource_ip_firewall_nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ import (
// ResourceIPFirewallNat https://wiki.mikrotik.com/wiki/Manual:IP/Firewall/NAT
func ResourceIPFirewallNat() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/ip/firewall/nat"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"bytes","packets"`),
MetaSetUnsetFields: PropSetUnsetFields(`"dst_address_list","src_address_list","in_interface_list","out_interface_list","in_bridge_port_list","out_bridge_port_list"`),
MetaResourcePath: PropResourcePath("/ip/firewall/nat"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields("bytes", "packets"),
MetaSetUnsetFields: PropSetUnsetFields("dst_address_list", "src_address_list", "in_interface_list",
"out_interface_list", "in_bridge_port_list", "out_bridge_port_list"),

"action": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_ipv6_firewall_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func ResourceIPv6FirewallFilter() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/ipv6/firewall/filter"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"bytes","packets"`),
MetaSkipFields: PropSkipFields("bytes", "packets"),

"action": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_routing_ospf_area.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func ResourceRoutingOspfArea() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/routing/ospf/area"),
MetaId: PropId(Id),
MetaSetUnsetFields: PropSetUnsetFields(`"no_summaries"`),
MetaSetUnsetFields: PropSetUnsetFields("no_summaries"),

"area_id": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_routing_ospf_interface_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ResourceRoutingOspfInterfaceTemplate() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/routing/ospf/interface-template"),
MetaId: PropId(Id),
MetaSetUnsetFields: PropSetUnsetFields(`"passive"`),
MetaSetUnsetFields: PropSetUnsetFields("passive"),

"area": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_system_certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func ResourceSystemCertificate() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/certificate"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"sign"`),
MetaSkipFields: PropSkipFields("sign"),

"authority": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_system_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func ResourceUser() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/user"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"last_logged_in"`),
MetaSkipFields: PropSkipFields("last_logged_in"),

"address": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_user_manager_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func ResourceUserManagerDatabase() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/user-manager/database"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"db_size","free_disk_space"`),
MetaSkipFields: PropSkipFields("db_size", "free_disk_space"),

"db_path": {
Type: schema.TypeString,
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_user_manager_user_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func ResourceUserManagerUserProfile() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/user-manager/user-profile"),
MetaId: PropId(Id),
MetaSkipFields: PropSkipFields(`"end_time","state"`),
MetaSkipFields: PropSkipFields("end_time", "state"),

"profile": {
Type: schema.TypeString,
Expand Down
Loading

0 comments on commit a67b772

Please sign in to comment.