Create a Meraki REST API wrapper for the switch port ressource. See the online documentation for more information.
- Source:
Example
const apiKey = 'secret meraki api key'
const organizationId = 'meraki organization id'
const version = 'v0'
const target = 'n12'
const basePath = `/${target}/${version}/devices`
const rateLimiter = {
enabled: true
}
const portEndpoints = require('./lib/rest/ports')({ apiKey, target, basePath, baseUrl, rateLimiter })
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
apiKey |
string |
<optional> |
''
|
The Meraki api key |
target |
string |
<optional> |
'api'
|
The Meraki target |
basePath |
string |
<optional> |
'/'
|
The Meraki base path for the switch port ressource |
rateLimiter |
string | The rate limiter (bottleneck) configuration |
||
logger |
object |
<optional> |
Logger to use if logging is enabled |
Returns:
The initialized Meraki REST API wrapper for the switch port ressource
- Type
- Object
Methods
(static) listSwitchPorts(apiKeyopt, targetopt, scopeopt, deviceSerial) → {Promise}
- Source:
List the switch ports for a switch.
Example
Example response
[
{
"number": 1,
"name": "my port",
"tags": "dorm-room limited",
"enabled": true,
"type": "access",
"vlan": 10,
"voiceVlan": 20,
"poeEnabled": true,
"isolationEnabled": false,
"rstpEnabled": true,
"stpGuard": "disabled",
"accessPolicyNumber": "asdf1234",
"linkNegotiation": "Auto negotiate"
}
]
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
deviceSerial |
string | The serial of the device for which to list the switch ports |
Returns:
A promise holding the switch ports of this device
- Type
- Promise
(static) showSwitchPort(apiKeyopt, targetopt, scopeopt, deviceSerial, number) → {Promise}
- Source:
Return a switch port.
Example
Example response
{
"number": 1,
"name": "my port",
"tags": "dorm-room limited",
"enabled": true,
"type": "access",
"vlan": 10,
"voiceVlan": 20,
"poeEnabled": true,
"isolationEnabled": false,
"rstpEnabled": true,
"stpGuard": "disabled",
"accessPolicyNumber": "asdf1234",
"linkNegotiation": "Auto negotiate"
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
deviceSerial |
string | The serial of the device for which to list the switch ports |
|
number |
number | The number of the switch port for which to show the details |
Returns:
A promise holding the details of this switch port
- Type
- Promise
(static) updateSwitchPort(apiKeyopt, targetopt, scopeopt, deviceSerial, number, name, tags, enabled, type, vlan, voiceVlan, allowedVlans, poeEnabled, isolationEnabled, rstpEnabled, stpGuard, accessPolicyNumber, linkNegotiation) → {Promise}
- Source:
Update a switch port.
Example
Example response
{
"number": 1,
"name": "my port",
"tags": "dorm-room limited",
"enabled": true,
"type": "access",
"vlan": 10,
"voiceVlan": 20,
"poeEnabled": true,
"isolationEnabled": false,
"rstpEnabled": true,
"stpGuard": "disabled",
"accessPolicyNumber": "asdf1234",
"linkNegotiation": "Auto negotiate"
}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiKey |
string |
<optional> |
Optional custom apiKey for this request (if not set will take the inital apiKey) |
target |
string |
<optional> |
Optional custom target for this request (if not set will take the inital target) |
scope |
string |
<optional> |
Optional custom scope for rate limiter |
deviceSerial |
string | The serial of the device for which to list the switch ports |
|
number |
number | The number of the switch port to update |
|
name |
string | The name of the switch port |
|
tags |
string | The tags of the switch port |
|
enabled |
boolean | The status of the switch port |
|
type |
string | The type of the switch port ( |
|
vlan |
number | The VLAN of the switch port |
|
voiceVlan |
number | The voice VLAN of the switch port. Only applicable to access ports |
|
allowedVlans |
Array | The VLANs allowed on the switch port. Only applicable to trunk ports |
|
poeEnabled |
boolean | The PoE status of the switch port |
|
isolationEnabled |
boolean | The isolation status of the switch port |
|
rstpEnabled |
boolean | The rapid spanning tree protocol status |
|
stpGuard |
string | The state of the STP guard ( |
|
accessPolicyNumber |
string | The number of the access policy of the switch port. Only applicable to access ports |
|
linkNegotiation |
string | The link speed for the switch port |
Returns:
A promise holding the updated switch port
- Type
- Promise