Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop v3.0.6 #38

Merged
merged 2 commits into from
Jul 15, 2024
Merged
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
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.06] - 2024-07-15
### Changed
- Managing different types of values are accepted in `appliance_traffic_shapping` operations.
- Managing different types of values are accepted in `wireless_ssids_firewall_l7FirewallRules` operations.

## [3.0.5] - 2024-07-09
### Changed
- `ResponseWirelessGetNetworkWirelessRfProfiles`is now an array.
Expand Down Expand Up @@ -1372,4 +1377,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[3.0.3]: https://github.com/meraki/dashboard-api-go/compare/v3.0.2...3.0.3
[3.0.4]: https://github.com/meraki/dashboard-api-go/compare/v3.0.3...3.0.4
[3.0.5]: https://github.com/meraki/dashboard-api-go/compare/v3.0.4...3.0.5
[Unreleased]: https://github.com/meraki/dashboard-api-go/compare/v3.0.5...main
[3.0.6]: https://github.com/meraki/dashboard-api-go/compare/v3.0.5...3.0.6
[Unreleased]: https://github.com/meraki/dashboard-api-go/compare/v3.0.6...main
41 changes: 37 additions & 4 deletions sdk/appliance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1072,9 +1072,42 @@ type ResponseApplianceGetNetworkApplianceTrafficShapingRulesRules struct {
Priority string `json:"priority,omitempty"` //
}
type ResponseApplianceGetNetworkApplianceTrafficShapingRulesRulesDefinitions struct {
Type string `json:"type,omitempty"` //
Value string `json:"value,omitempty"` //
Type string `json:"type,omitempty"` //
Value *string //
ValueObj *ResponseApplianceGetNetworkApplianceFirewallL7FirewallRulesRulesValueObj //
ValueList *[]string //
}

func (r *ResponseApplianceGetNetworkApplianceTrafficShapingRulesRulesDefinitions) UnmarshalJSON(data []byte) error {
type Alias ResponseApplianceGetNetworkApplianceTrafficShapingRulesRulesDefinitions
aux := &struct {
Value interface{} `json:"value"`
*Alias
}{
Alias: (*Alias)(r),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
switch v := aux.Value.(type) {
case string:
r.Value = &v
case []interface{}:
strList := make([]string, len(v))
for i, item := range v {
strList[i] = item.(string)
}
r.ValueList = &strList
case map[string]interface{}:
valueObj := &ResponseApplianceGetNetworkApplianceFirewallL7FirewallRulesRulesValueObj{
ID: v["id"].(string),
Name: v["name"].(string),
}
r.ValueObj = valueObj
}
return nil
}

type ResponseApplianceGetNetworkApplianceTrafficShapingRulesRulesPerClientBandwidthLimits struct {
BandwidthLimits *ResponseApplianceGetNetworkApplianceTrafficShapingRulesRulesPerClientBandwidthLimitsBandwidthLimits `json:"bandwidthLimits,omitempty"` //
Settings string `json:"settings,omitempty"` //
Expand Down Expand Up @@ -2245,8 +2278,8 @@ type RequestApplianceUpdateNetworkApplianceTrafficShapingRulesRules struct {
Priority string `json:"priority,omitempty"` // A string, indicating the priority level for packets bound to your rule. Can be 'low', 'normal' or 'high'.
}
type RequestApplianceUpdateNetworkApplianceTrafficShapingRulesRulesDefinitions struct {
Type string `json:"type,omitempty"` // The type of definition. Can be one of 'application', 'applicationCategory', 'host', 'port', 'ipRange' or 'localNet'.
Value string `json:"value,omitempty"` // If "type" is 'host', 'port', 'ipRange' or 'localNet', then "value" must be a string, matching either a hostname (e.g. "somesite.com"), a port (e.g. 8080), or an IP range ("192.1.0.0", "192.1.0.0/16", or "10.1.0.0/16:80"). 'localNet' also supports CIDR notation, excluding custom ports. If "type" is 'application' or 'applicationCategory', then "value" must be an object with the structure { "id": "meraki:layer7/..." }, where "id" is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
Type string `json:"type,omitempty"` // The type of definition. Can be one of 'application', 'applicationCategory', 'host', 'port', 'ipRange' or 'localNet'.
Value interface{} `json:"value,omitempty"` // If "type" is 'host', 'port', 'ipRange' or 'localNet', then "value" must be a string, matching either a hostname (e.g. "somesite.com"), a port (e.g. 8080), or an IP range ("192.1.0.0", "192.1.0.0/16", or "10.1.0.0/16:80"). 'localNet' also supports CIDR notation, excluding custom ports. If "type" is 'application' or 'applicationCategory', then "value" must be an object with the structure { "id": "meraki:layer7/..." }, where "id" is the application category or application ID (for a list of IDs for your network, use the trafficShaping/applicationCategories endpoint).
}
type RequestApplianceUpdateNetworkApplianceTrafficShapingRulesRulesPerClientBandwidthLimits struct {
BandwidthLimits *RequestApplianceUpdateNetworkApplianceTrafficShapingRulesRulesPerClientBandwidthLimitsBandwidthLimits `json:"bandwidthLimits,omitempty"` // The bandwidth limits object, specifying the upload ('limitUp') and download ('limitDown') speed in Kbps. These are only enforced if 'settings' is set to 'custom'.
Expand Down
93 changes: 84 additions & 9 deletions sdk/wireless.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package meraki

import (
"encoding/json"
"fmt"
"strings"

Expand Down Expand Up @@ -1921,18 +1922,86 @@ type ResponseWirelessGetNetworkWirelessSSIDFirewallL7FirewallRules struct {
Rules *[]ResponseWirelessGetNetworkWirelessSSIDFirewallL7FirewallRulesRules `json:"rules,omitempty"` // An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule).
}
type ResponseWirelessGetNetworkWirelessSSIDFirewallL7FirewallRulesRules struct {
Policy string `json:"policy,omitempty"` // 'Deny' traffic specified by this rule
Type string `json:"type,omitempty"` // Type of the L7 firewall rule. One of: 'application', 'applicationCategory', 'host', 'port', 'ipRange'
Value string `json:"value,omitempty"` // The value of what needs to get blocked. Format of the value varies depending on type of the firewall rule selected.
Policy string `json:"policy,omitempty"` // 'Deny' traffic specified by this rule
Type string `json:"type,omitempty"` // Type of the L7 firewall rule. One of: 'application', 'applicationCategory', 'host', 'port', 'ipRange'
Value *string //
ValueObj *ResponseApplianceGetNetworkApplianceFirewallL7FirewallRulesRulesValueObj //
ValueList *[]string //
}
type ResponseWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRules struct {
Rules *[]ResponseWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRules `json:"rules,omitempty"` // An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule).
}
type ResponseWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRules struct {
Policy string `json:"policy,omitempty"` // 'Deny' traffic specified by this rule
Type string `json:"type,omitempty"` // Type of the L7 firewall rule. One of: 'application', 'applicationCategory', 'host', 'port', 'ipRange'
Value string `json:"value,omitempty"` // The value of what needs to get blocked. Format of the value varies depending on type of the firewall rule selected.
Policy string `json:"policy,omitempty"` // 'Deny' traffic specified by this rule
Type string `json:"type,omitempty"` // Type of the L7 firewall rule. One of: 'application', 'applicationCategory', 'host', 'port', 'ipRange'
Value *string //
ValueObj *ResponseApplianceGetNetworkApplianceFirewallL7FirewallRulesRulesValueObj //
ValueList *[]string //
}
type ResponseWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRulesValueObj struct {
ID string `json:"id,omitempty"` //
Name string `json:"name,omitempty"` //
}

func (r *ResponseWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRules) UnmarshalJSON(data []byte) error {
type Alias ResponseWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRules
aux := &struct {
Value interface{} `json:"value"`
*Alias
}{
Alias: (*Alias)(r),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
switch v := aux.Value.(type) {
case string:
r.Value = &v
case []interface{}:
strList := make([]string, len(v))
for i, item := range v {
strList[i] = item.(string)
}
r.ValueList = &strList
case map[string]interface{}:
valueObj := &ResponseApplianceGetNetworkApplianceFirewallL7FirewallRulesRulesValueObj{
ID: v["id"].(string),
Name: v["name"].(string),
}
r.ValueObj = valueObj
}
return nil
}
func (r *ResponseWirelessGetNetworkWirelessSSIDFirewallL7FirewallRulesRules) UnmarshalJSON(data []byte) error {
type Alias ResponseWirelessGetNetworkWirelessSSIDFirewallL7FirewallRulesRules
aux := &struct {
Value interface{} `json:"value"`
*Alias
}{
Alias: (*Alias)(r),
}
if err := json.Unmarshal(data, &aux); err != nil {
return err
}
switch v := aux.Value.(type) {
case string:
r.Value = &v
case []interface{}:
strList := make([]string, len(v))
for i, item := range v {
strList[i] = item.(string)
}
r.ValueList = &strList
case map[string]interface{}:
valueObj := &ResponseApplianceGetNetworkApplianceFirewallL7FirewallRulesRulesValueObj{
ID: v["id"].(string),
Name: v["name"].(string),
}
r.ValueObj = valueObj
}
return nil
}

type ResponseWirelessGetNetworkWirelessSSIDHotspot20 struct {
Domains []string `json:"domains,omitempty"` //
Enabled *bool `json:"enabled,omitempty"` //
Expand Down Expand Up @@ -3186,10 +3255,16 @@ type RequestWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRules struct {
Rules *[]RequestWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRules `json:"rules,omitempty"` // An array of L7 firewall rules for this SSID. Rules will get applied in the same order user has specified in request. Empty array will clear the L7 firewall rule configuration.
}
type RequestWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRules struct {
Policy string `json:"policy,omitempty"` // 'Deny' traffic specified by this rule
Type string `json:"type,omitempty"` // Type of the L7 firewall rule. One of: 'application', 'applicationCategory', 'host', 'port', 'ipRange'
Value string `json:"value,omitempty"` // The value of what needs to get blocked. Format of the value varies depending on type of the firewall rule selected.
Policy string `json:"policy,omitempty"` // 'Deny' traffic specified by this rule
Type string `json:"type,omitempty"` // Type of the L7 firewall rule. One of: 'application', 'applicationCategory', 'host', 'port', 'ipRange'
Value interface{} `json:"value,omitempty"` // The 'value' of what you want to block. Format of 'value' varies depending on type of the rule. The application categories and application ids can be retrieved from the the 'MX L7 application categories' endpoint. The countries follow the two-letter ISO 3166-1 alpha-2 format.
}

type RequestWirelessUpdateNetworkWirelessSSIDFirewallL7FirewallRulesRulesValue struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}

type RequestWirelessUpdateNetworkWirelessSSIDHotspot20 struct {
Domains []string `json:"domains,omitempty"` // An array of domain names
Enabled *bool `json:"enabled,omitempty"` // Whether or not Hotspot 2.0 for this SSID is enabled
Expand Down
Loading