Skip to content

Commit

Permalink
chore: go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vaerh committed Jan 15, 2024
1 parent 2690373 commit 63d25c3
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 103 deletions.
6 changes: 3 additions & 3 deletions routeros/provider_schema_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ func PropName(description string) *schema.Schema {
// PropMacAddress
func PropMacAddressRw(description string, required bool) *schema.Schema {
mac := &schema.Schema{
Type: schema.TypeString,
Description: description,
ValidateFunc: validation.IsMACAddress,
Type: schema.TypeString,
Description: description,
ValidateFunc: validation.IsMACAddress,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
if old != "" && d.GetRawConfig().GetAttr(k).IsNull() {
return true
Expand Down
32 changes: 16 additions & 16 deletions routeros/resource_capsman_access_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ func ResourceCapsManAccessList() *schema.Resource {
MetaResourcePath: PropResourcePath("/caps-man/access-list"),
MetaId: PropId(Id),

KeyComment: PropCommentRw,
KeyComment: PropCommentRw,
KeyDisabled: PropDisabledRw,
"action": {
Type: schema.TypeString,
Optional: true,
Description: "An action to take when a client matches.",
Type: schema.TypeString,
Optional: true,
Description: "An action to take when a client matches.",
ValidateFunc: validation.StringInSlice([]string{"accept", "reject", "query-radius"}, false),
},
"allow_signal_out_of_range": {
Type: schema.TypeString,
Optional: true,
Default: "10s",
Description: "An option that permits the client's signal to be out of the range always or for some time interval.",
Type: schema.TypeString,
Optional: true,
Default: "10s",
Description: "An option that permits the client's signal to be out of the range always or for some time interval.",
DiffSuppressFunc: TimeEquall,
},
"ap_tx_limit": {
Expand Down Expand Up @@ -70,8 +70,8 @@ func ResourceCapsManAccessList() *schema.Resource {
Description: "MAC address mask to apply when comparing clients' addresses.",
},
"interface": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "Interface name to compare with an interface to which the client actually connects to.",
},
KeyPlaceBefore: PropPlaceBefore,
Expand All @@ -92,14 +92,14 @@ func ResourceCapsManAccessList() *schema.Resource {
Description: "The range in which the client signal must fall.",
},
"ssid_regexp": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: "The regular expression to compare the actual SSID the client connects to.",
},
"time": {
Type: schema.TypeString,
Optional: true,
Default: "0s-1d,sun,mon,tue,wed,thu,fri,sat",
Default: "0s-1d,sun,mon,tue,wed,thu,fri,sat",
Description: "Time of the day and days of the week when the rule is applicable.",
},
"vlan_id": {
Expand All @@ -109,9 +109,9 @@ func ResourceCapsManAccessList() *schema.Resource {
ValidateFunc: validation.IntBetween(1, 4094),
},
"vlan_mode": {
Type: schema.TypeString,
Optional: true,
Description: "VLAN tagging mode specifies if traffic coming from a client should get tagged and untagged when it goes back to the client.",
Type: schema.TypeString,
Optional: true,
Description: "VLAN tagging mode specifies if traffic coming from a client should get tagged and untagged when it goes back to the client.",
ValidateFunc: validation.StringInSlice([]string{"no-tag", "use-service-tag", "use-tag"}, false),
},
}
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_interface_bridge_mlag _test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import (

func TestAccInterfaceBridgeMlagTest_basic(t *testing.T) {
t.Log("Test skipped, The test is skipped, the resource is only available on real hardware.")
}
}
54 changes: 27 additions & 27 deletions routeros/resource_interface_dot1x.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func ResourceInterfaceDot1xClient() *schema.Resource {

return &schema.Resource{
CreateContext: DefaultCreate(resSchema),
ReadContext: DefaultRead(resSchema),
ReadContext: DefaultRead(resSchema),
UpdateContext: DefaultUpdate(resSchema),
DeleteContext: DefaultDelete(resSchema),

Expand All @@ -74,10 +74,10 @@ func ResourceInterfaceDot1xServer() *schema.Resource {
Description: "Whether to send RADIUS accounting requests to the authentication server.",
},
"auth_timeout": {
Type: schema.TypeString,
Optional: true,
Default: "1m",
Description: "Total time available for EAP authentication.",
Type: schema.TypeString,
Optional: true,
Default: "1m",
Description: "Total time available for EAP authentication.",
DiffSuppressFunc: TimeEquall,
},
"auth_types": {
Expand All @@ -96,17 +96,17 @@ func ResourceInterfaceDot1xServer() *schema.Resource {
},
KeyInterface: PropInterfaceRw,
"interim_update": {
Type: schema.TypeString,
Optional: true,
Default: "0s",
Description: "Interval between scheduled RADIUS Interim-Update messages.",
Type: schema.TypeString,
Optional: true,
Default: "0s",
Description: "Interval between scheduled RADIUS Interim-Update messages.",
DiffSuppressFunc: TimeEquall,
},
"mac_auth_mode": {
Type: schema.TypeString,
Optional: true,
Default: "mac-as-username",
Description: "An option that allows to control User-Name and User-Password RADIUS attributes when using MAC authentication.",
Type: schema.TypeString,
Optional: true,
Default: "mac-as-username",
Description: "An option that allows to control User-Name and User-Password RADIUS attributes when using MAC authentication.",
ValidateFunc: validation.StringInSlice([]string{"mac-as-username", "mac-as-username-and-password"}, false),
},
"radius_mac_format": {
Expand All @@ -118,35 +118,35 @@ func ResourceInterfaceDot1xServer() *schema.Resource {
"xx-xx-xx-xx-xx-xx", "xx:xx:xx:xx:xx:xx", "xxxxxxxxxxxx"}, false),
},
"reauth_timeout": {
Type: schema.TypeString,
Optional: true,
Description: "An option that enables server port re-authentication.",
Type: schema.TypeString,
Optional: true,
Description: "An option that enables server port re-authentication.",
DiffSuppressFunc: TimeEquall,
},
"reject_vlan_id": {
Type: schema.TypeInt,
Optional: true,
Description: "Assigned VLAN when authentication failed, and a RADIUS server responded with an Access-Reject message. ",
Type: schema.TypeInt,
Optional: true,
Description: "Assigned VLAN when authentication failed, and a RADIUS server responded with an Access-Reject message. ",
ValidateFunc: validation.IntBetween(1, 4094),
},
"retrans_timeout": {
Type: schema.TypeString,
Optional: true,
Default: "30s",
Description: "The time interval between message re-transmissions if no response is received from the supplicant.",
Type: schema.TypeString,
Optional: true,
Default: "30s",
Description: "The time interval between message re-transmissions if no response is received from the supplicant.",
DiffSuppressFunc: TimeEquall,
},
"server_fail_vlan_id": {
Type: schema.TypeInt,
Optional: true,
Description: "Assigned VLAN when RADIUS server is not responding and request timed out.",
Type: schema.TypeInt,
Optional: true,
Description: "Assigned VLAN when RADIUS server is not responding and request timed out.",
ValidateFunc: validation.IntBetween(1, 4094),
},
}

return &schema.Resource{
CreateContext: DefaultCreate(resSchema),
ReadContext: DefaultRead(resSchema),
ReadContext: DefaultRead(resSchema),
UpdateContext: DefaultUpdate(resSchema),
DeleteContext: DefaultDelete(resSchema),

Expand Down
34 changes: 17 additions & 17 deletions routeros/resource_interface_ethernet_switch_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,49 +35,49 @@ func ResourceInterfaceEthernetSwitchHost() *schema.Resource {
"drop": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to drop a frame with matching MAC source address received on a certain port (matching "+
"destination or source address for CRS3xx series switches).",
Description: "Whether to drop a frame with matching MAC source address received on a certain port (matching " +
"destination or source address for CRS3xx series switches).",
},
KeyDynamic: PropDynamicRo,
KeyInvalid: PropInvalidRo,
KeyDynamic: PropDynamicRo,
KeyInvalid: PropInvalidRo,
KeyMacAddress: PropMacAddressRw("Host's MAC address.", true),
"mirror": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to send a frame copy to mirror-target port from a frame with matching MAC destination address "+
"(matching destination or source address for CRS3xx series switches).",
Description: "Whether to send a frame copy to mirror-target port from a frame with matching MAC destination address " +
"(matching destination or source address for CRS3xx series switches).",
},
"ports": {
Type: schema.TypeList,
Required: true,
Type: schema.TypeList,
Required: true,
Description: "Name of the interface, static MAC address can be mapped to more that one port, including switch CPU port.",
Elem: &schema.Schema{
Type: schema.TypeString,
Type: schema.TypeString,
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
},
"redirect_to_cpu": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to redirect a frame to switch CPU port from a frame with matching MAC destination address "+
"(matching destination or source address for CRS3xx series switches).",
Description: "Whether to redirect a frame to switch CPU port from a frame with matching MAC destination address " +
"(matching destination or source address for CRS3xx series switches).",
},
"share_vlan_learned": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether the static host MAC address lookup is used with shared-VLAN-learning (SVL) or "+
"independent-VLAN-learning (IVL). The SVL mode is used for those VLAN entries that do not support IVL or IVL is "+
"disabled (independent-learning=no).",
Description: "Whether the static host MAC address lookup is used with shared-VLAN-learning (SVL) or " +
"independent-VLAN-learning (IVL). The SVL mode is used for those VLAN entries that do not support IVL or IVL is " +
"disabled (independent-learning=no).",
},
"switch": {
Type: schema.TypeString,
Required: true,
Description: "Name of the switch to which the MAC address is going to be assigned to.",
},
"vlan_id": {
Type: schema.TypeString,
Optional: true,
Description: "VLAN ID for the statically added MAC address entry.",
Type: schema.TypeInt,
Optional: true,
Description: "VLAN ID for the statically added MAC address entry.",
ValidateFunc: validation.IntBetween(0, 4094),
DiffSuppressFunc: AlwaysPresentNotUserProvided,
},
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_interface_ethernet_switch_host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import (

func TestAccInterfaceEthernetSwitchHost_basic(t *testing.T) {
t.Log("Test skipped, The test is skipped, the resource is only available on real hardware.")
}
}
2 changes: 1 addition & 1 deletion routeros/resource_interface_ethernet_switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import (

func TestAccInterfaceEthernetSwitchTest_basic(t *testing.T) {
t.Log("Test skipped, The test is skipped, the resource is only available on real hardware.")
}
}
24 changes: 12 additions & 12 deletions routeros/resource_ip_dhcp_server_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ func ResourceDhcpServerConfig() *schema.Resource {
Description: "An option that enables accounting for DHCP leases.",
},
"interim_update": {
Type: schema.TypeString,
Optional: true,
Default: "0s",
Description: "An option determining whether the DHCP server sends periodic updates to the accounting server during a lease.",
Type: schema.TypeString,
Optional: true,
Default: "0s",
Description: "An option determining whether the DHCP server sends periodic updates to the accounting server during a lease.",
DiffSuppressFunc: TimeEquall,
},
"radius_password": {
Type: schema.TypeString,
Optional: true,
Default: "empty",
Description: "An option to set the password parameter for the RADIUS server. This option is available in RouterOS starting from version 7.0.",
Type: schema.TypeString,
Optional: true,
Default: "empty",
Description: "An option to set the password parameter for the RADIUS server. This option is available in RouterOS starting from version 7.0.",
ValidateFunc: validation.StringInSlice([]string{"empty", "same-as-user"}, false),
},
"store_leases_disk": {
Type: schema.TypeString,
Optional: true,
Default: "5m",
Description: "An option of how often the DHCP leases will be stored on disk.",
Type: schema.TypeString,
Optional: true,
Default: "5m",
Description: "An option of how often the DHCP leases will be stored on disk.",
DiffSuppressFunc: TimeEquall,
},
}
Expand Down
2 changes: 1 addition & 1 deletion routeros/resource_ovpn_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func ResourceOpenVPNServer() *schema.Resource {
ValidateDiagFunc: ValidationMultiValInSlice([]string{
"null", "aes128-cbc", "aes128-gcm", "aes192-cbc", "aes192-gcm", "aes256-cbc", "aes256-gcm", "blowfish128",
// Backward compatibility with ROS v7.7
"aes128", "aes192", "aes256",
"aes128", "aes192", "aes256",
}, false, false),
},
"default_profile": {
Expand Down
Loading

0 comments on commit 63d25c3

Please sign in to comment.