dashboard-api 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +34 -0
- data/.gitignore +5 -4
- data/.travis.yml +20 -0
- data/Gemfile +9 -5
- data/Gemfile.lock +63 -31
- data/README.md +134 -138
- data/Rakefile +9 -7
- data/dashboard-api.gemspec +28 -28
- data/doc/Admins.html +603 -603
- data/doc/Clients.html +276 -276
- data/doc/DashboardAPI.html +603 -603
- data/doc/DashboardAPIVersion.html +159 -159
- data/doc/Devices.html +879 -879
- data/doc/Networks.html +1382 -1382
- data/doc/Organizations.html +1477 -1477
- data/doc/Phones.html +641 -641
- data/doc/SAML.html +758 -758
- data/doc/SSIDs.html +523 -523
- data/doc/Switchports.html +526 -526
- data/doc/Templates.html +378 -378
- data/doc/VLANs.html +762 -762
- data/doc/_index.html +235 -235
- data/doc/class_list.html +51 -51
- data/doc/css/full_list.css +58 -58
- data/doc/css/style.css +481 -481
- data/doc/file.README.html +248 -248
- data/doc/file_list.html +56 -56
- data/doc/frames.html +17 -17
- data/doc/index.html +248 -248
- data/doc/js/app.js +243 -243
- data/doc/js/full_list.js +216 -216
- data/doc/js/jquery.js +3 -3
- data/doc/method_list.html +523 -523
- data/doc/top-level-namespace.html +113 -113
- data/lib/admins.rb +37 -37
- data/lib/clients.rb +12 -12
- data/lib/dashboard-api.rb +82 -83
- data/lib/dashboard-api/version.rb +6 -6
- data/lib/devices.rb +57 -57
- data/lib/networks.rb +108 -108
- data/lib/organizations.rb +110 -115
- data/lib/phones.rb +40 -40
- data/lib/saml.rb +47 -47
- data/lib/ssids.rb +33 -33
- data/lib/switchports.rb +33 -33
- data/lib/templates.rb +18 -18
- data/lib/vlans.rb +49 -49
- metadata +7 -5
@@ -1,6 +1,6 @@
|
|
1
|
-
# Version number of the Gem build
|
2
|
-
# @author Joe Letizia
|
3
|
-
module DashboardAPIVersion
|
4
|
-
# Current version number of the gem
|
5
|
-
VERSION = "1.0.
|
6
|
-
end
|
1
|
+
# Version number of the Gem build
|
2
|
+
# @author Joe Letizia
|
3
|
+
module DashboardAPIVersion
|
4
|
+
# Current version number of the gem
|
5
|
+
VERSION = "1.0.1"
|
6
|
+
end
|
data/lib/devices.rb
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
# Devices section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module Devices
|
4
|
-
# List all devices in a given network
|
5
|
-
# @param [String] network_id network that you want to get devices for
|
6
|
-
# @return [Array] array of hashes containing device information for all devices in the network
|
7
|
-
def list_devices_in_network(network_id)
|
8
|
-
self.make_api_call("/networks/#{network_id}/devices", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Device information for a specified device
|
12
|
-
# @param [String] network_id the network id where the device exists
|
13
|
-
# @param [String] device_serial the meraki serial number of the device you want to get
|
14
|
-
# information for
|
15
|
-
# @return [Hash] a hash containing all of the devices attributes
|
16
|
-
def get_single_device(network_id, device_serial)
|
17
|
-
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}", 'GET')
|
18
|
-
end
|
19
|
-
|
20
|
-
# Uplink information for a specified device
|
21
|
-
# @param [String] network_id network id where the device exists
|
22
|
-
# @param [String] device_serial meraki serial number of the device you want to check
|
23
|
-
# @return [Array] an array of hashes for each uplink and it's attributes
|
24
|
-
def get_device_uplink_stats(network_id, device_serial)
|
25
|
-
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}/uplink", 'GET')
|
26
|
-
end
|
27
|
-
|
28
|
-
# Update a single devices attributes
|
29
|
-
# @param [String] network_id dashboard network id where the device exists
|
30
|
-
# @param [String] device_serial meraki serial number of the device you want to modify
|
31
|
-
# @param [Hash] options hash containing the attributes you want to modify.
|
32
|
-
# such as name, tags, longitude, latitude. A full list is found on the official Meraki API Docs
|
33
|
-
# @return [Hash] a hash containing the devices new attribute set
|
34
|
-
def update_device_attributes(network_id, device_serial, options)
|
35
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
36
|
-
|
37
|
-
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}", 'PUT', options)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Claim a single device into a network
|
41
|
-
# @param [String] network_id dashboard network id to claim device into
|
42
|
-
# @param [Hash] options hash containing :serial => 'meraki device SN' you want to claim
|
43
|
-
# @return [Integer] code returns the HTTP code of the API call
|
44
|
-
def claim_device_into_network(network_id, options)
|
45
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
46
|
-
|
47
|
-
self.make_api_call("/networks/#{network_id}/devices/claim", 'POST', options)
|
48
|
-
end
|
49
|
-
|
50
|
-
# Remove a single device from a network
|
51
|
-
# @param [String] network_id dashboard network id to remove device from
|
52
|
-
# @param [String] device_serial meraki serial number for device to remove
|
53
|
-
# @return [Integer] http_code HTTP code for API call
|
54
|
-
def remove_device_from_network(network_id, device_serial)
|
55
|
-
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}/remove", 'POST')
|
56
|
-
end
|
57
|
-
end
|
1
|
+
# Devices section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Devices
|
4
|
+
# List all devices in a given network
|
5
|
+
# @param [String] network_id network that you want to get devices for
|
6
|
+
# @return [Array] array of hashes containing device information for all devices in the network
|
7
|
+
def list_devices_in_network(network_id)
|
8
|
+
self.make_api_call("/networks/#{network_id}/devices", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Device information for a specified device
|
12
|
+
# @param [String] network_id the network id where the device exists
|
13
|
+
# @param [String] device_serial the meraki serial number of the device you want to get
|
14
|
+
# information for
|
15
|
+
# @return [Hash] a hash containing all of the devices attributes
|
16
|
+
def get_single_device(network_id, device_serial)
|
17
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}", 'GET')
|
18
|
+
end
|
19
|
+
|
20
|
+
# Uplink information for a specified device
|
21
|
+
# @param [String] network_id network id where the device exists
|
22
|
+
# @param [String] device_serial meraki serial number of the device you want to check
|
23
|
+
# @return [Array] an array of hashes for each uplink and it's attributes
|
24
|
+
def get_device_uplink_stats(network_id, device_serial)
|
25
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}/uplink", 'GET')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Update a single devices attributes
|
29
|
+
# @param [String] network_id dashboard network id where the device exists
|
30
|
+
# @param [String] device_serial meraki serial number of the device you want to modify
|
31
|
+
# @param [Hash] options hash containing the attributes you want to modify.
|
32
|
+
# such as name, tags, longitude, latitude. A full list is found on the official Meraki API Docs
|
33
|
+
# @return [Hash] a hash containing the devices new attribute set
|
34
|
+
def update_device_attributes(network_id, device_serial, options)
|
35
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
36
|
+
|
37
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}", 'PUT', options)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Claim a single device into a network
|
41
|
+
# @param [String] network_id dashboard network id to claim device into
|
42
|
+
# @param [Hash] options hash containing :serial => 'meraki device SN' you want to claim
|
43
|
+
# @return [Integer] code returns the HTTP code of the API call
|
44
|
+
def claim_device_into_network(network_id, options)
|
45
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
46
|
+
|
47
|
+
self.make_api_call("/networks/#{network_id}/devices/claim", 'POST', options)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Remove a single device from a network
|
51
|
+
# @param [String] network_id dashboard network id to remove device from
|
52
|
+
# @param [String] device_serial meraki serial number for device to remove
|
53
|
+
# @return [Integer] http_code HTTP code for API call
|
54
|
+
def remove_device_from_network(network_id, device_serial)
|
55
|
+
self.make_api_call("/networks/#{network_id}/devices/#{device_serial}/remove", 'POST')
|
56
|
+
end
|
57
|
+
end
|
data/lib/networks.rb
CHANGED
@@ -1,108 +1,108 @@
|
|
1
|
-
# Networks section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module Networks
|
4
|
-
# Returns the list of networks for a given organization
|
5
|
-
# @param [String] org_id dashboard organization ID
|
6
|
-
# @return [Array] an array of hashes containing the network details
|
7
|
-
def get_networks(org_id)
|
8
|
-
self.make_api_call("/organizations/#{org_id}/networks", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Returns the network details for a single network
|
12
|
-
# @param [String] network_id dashboard network ID
|
13
|
-
# @return [Hash] a hash containing the network details of the specific network
|
14
|
-
def get_single_network(network_id)
|
15
|
-
self.make_api_call("/networks/#{network_id}", 'GET')
|
16
|
-
end
|
17
|
-
|
18
|
-
# Updates a network's details
|
19
|
-
# @param [String] network_id dashboard network ID
|
20
|
-
# @param [Hash] options a hash containing any of the following keys:
|
21
|
-
# name: the network name
|
22
|
-
# tags: tags assigned to the network
|
23
|
-
# @return [Hash] a hash containing the updated network details
|
24
|
-
def update_network(network_id, options)
|
25
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
26
|
-
|
27
|
-
self.make_api_call("/networks/#{network_id}",'PUT', options)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Create a new Dashboard network
|
31
|
-
# @param [String] org_id dashboard organization ID
|
32
|
-
# @param [Hash] options a hash containing the following options:
|
33
|
-
# name: the network name (REQUIRED)
|
34
|
-
# type: the type of network (wireless, switch, appliance, or phone) (REQUIRED)
|
35
|
-
# tags: tags for the network (NOT REQUIRED)
|
36
|
-
# @return [Hash] a hash containing the new networks details
|
37
|
-
def create_network(org_id, options)
|
38
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
39
|
-
|
40
|
-
self.make_api_call("/organizations/#{org_id}/networks", 'POST', options)
|
41
|
-
end
|
42
|
-
|
43
|
-
# Delete an existing Dashboard network
|
44
|
-
# @param [String] network_id dashboard netwok ID to delete
|
45
|
-
# @return [Bool] status true if the network was deleted, false if not
|
46
|
-
def delete_network(network_id)
|
47
|
-
res = self.make_api_call("/networks/#{network_id}", 'DELETE')
|
48
|
-
return res.code == 204 ? true : false
|
49
|
-
end
|
50
|
-
|
51
|
-
# Get AutoVPN settings for a specific network
|
52
|
-
# @param [String] network_id dashboard network ID to get AutoVPN settings for
|
53
|
-
# @return [Hash] a hash containing the AutoVPN details for the network
|
54
|
-
def get_auto_vpn_settings(network_id)
|
55
|
-
res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'GET')
|
56
|
-
end
|
57
|
-
|
58
|
-
# Update AutoVPN for a specific network
|
59
|
-
# @param [String] network_id dashboard network ID to update AutoVPN settings for
|
60
|
-
# @param [Hash] options options hash containing the following options:
|
61
|
-
# mode: hub, spoke or none
|
62
|
-
# hubs: an array of Hashes containing the hubId and a true or false for useDefaultRoute
|
63
|
-
# subnets: an array of Hashes containing localSubnet and useVPN
|
64
|
-
# @return [Hash]
|
65
|
-
def update_auto_vpn_settings(network_id, options)
|
66
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
67
|
-
|
68
|
-
|
69
|
-
res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'PUT', options)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Get all MS access policies configured for a specific Dashboard network
|
73
|
-
# @param [String] network_id dashboard network ID to get MS policies for
|
74
|
-
# @return [Array] an array of hashes for containing the policy information
|
75
|
-
def get_ms_access_policies(network_id)
|
76
|
-
res = self.make_api_call("/networks/#{network_id}/accessPolicies", 'GET')
|
77
|
-
return res
|
78
|
-
end
|
79
|
-
|
80
|
-
# Bind a single network to a configuration template
|
81
|
-
# @param [String] network_id the source network that you want to bind to a tempalte
|
82
|
-
# @param [Hash] options options hash that contains configTemplateId and autoBind values. Refer to the official
|
83
|
-
# Meraki Dashboard API documentation for more information on these.
|
84
|
-
# @return [Integer] HTTP Code
|
85
|
-
def bind_network_to_template(network_id, options)
|
86
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
87
|
-
|
88
|
-
|
89
|
-
self.make_api_call("/networks/#{network_id}/bind", 'POST', options)
|
90
|
-
end
|
91
|
-
|
92
|
-
# Unbind a single network from a configuration template
|
93
|
-
# @param [String] network_id the network that you want to unbind from it's template
|
94
|
-
# @return [Integer] HTTP Code
|
95
|
-
def unbind_network_to_template(network_id)
|
96
|
-
self.make_api_call("/networks/#{network_id}/unbind", 'POST')
|
97
|
-
end
|
98
|
-
|
99
|
-
# Return traffic analysis data for a network
|
100
|
-
# @param [String] network_id network that you want data for
|
101
|
-
# @param [Hash] options options hash containing a timespan and deviceType. Refer to the official
|
102
|
-
# Meraki Dashboard API documentation for more information on these.
|
103
|
-
def traffic_analysis(network_id, options)
|
104
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
105
|
-
|
106
|
-
self.make_api_call("/networks/#{network_id}/traffic", 'GET', options)
|
107
|
-
end
|
108
|
-
end
|
1
|
+
# Networks section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Networks
|
4
|
+
# Returns the list of networks for a given organization
|
5
|
+
# @param [String] org_id dashboard organization ID
|
6
|
+
# @return [Array] an array of hashes containing the network details
|
7
|
+
def get_networks(org_id)
|
8
|
+
self.make_api_call("/organizations/#{org_id}/networks", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the network details for a single network
|
12
|
+
# @param [String] network_id dashboard network ID
|
13
|
+
# @return [Hash] a hash containing the network details of the specific network
|
14
|
+
def get_single_network(network_id)
|
15
|
+
self.make_api_call("/networks/#{network_id}", 'GET')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Updates a network's details
|
19
|
+
# @param [String] network_id dashboard network ID
|
20
|
+
# @param [Hash] options a hash containing any of the following keys:
|
21
|
+
# name: the network name
|
22
|
+
# tags: tags assigned to the network
|
23
|
+
# @return [Hash] a hash containing the updated network details
|
24
|
+
def update_network(network_id, options)
|
25
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
26
|
+
|
27
|
+
self.make_api_call("/networks/#{network_id}",'PUT', options)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Create a new Dashboard network
|
31
|
+
# @param [String] org_id dashboard organization ID
|
32
|
+
# @param [Hash] options a hash containing the following options:
|
33
|
+
# name: the network name (REQUIRED)
|
34
|
+
# type: the type of network (wireless, switch, appliance, or phone) (REQUIRED)
|
35
|
+
# tags: tags for the network (NOT REQUIRED)
|
36
|
+
# @return [Hash] a hash containing the new networks details
|
37
|
+
def create_network(org_id, options)
|
38
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
39
|
+
|
40
|
+
self.make_api_call("/organizations/#{org_id}/networks", 'POST', options)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Delete an existing Dashboard network
|
44
|
+
# @param [String] network_id dashboard netwok ID to delete
|
45
|
+
# @return [Bool] status true if the network was deleted, false if not
|
46
|
+
def delete_network(network_id)
|
47
|
+
res = self.make_api_call("/networks/#{network_id}", 'DELETE')
|
48
|
+
return res.code == 204 ? true : false
|
49
|
+
end
|
50
|
+
|
51
|
+
# Get AutoVPN settings for a specific network
|
52
|
+
# @param [String] network_id dashboard network ID to get AutoVPN settings for
|
53
|
+
# @return [Hash] a hash containing the AutoVPN details for the network
|
54
|
+
def get_auto_vpn_settings(network_id)
|
55
|
+
res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'GET')
|
56
|
+
end
|
57
|
+
|
58
|
+
# Update AutoVPN for a specific network
|
59
|
+
# @param [String] network_id dashboard network ID to update AutoVPN settings for
|
60
|
+
# @param [Hash] options options hash containing the following options:
|
61
|
+
# mode: hub, spoke or none
|
62
|
+
# hubs: an array of Hashes containing the hubId and a true or false for useDefaultRoute
|
63
|
+
# subnets: an array of Hashes containing localSubnet and useVPN
|
64
|
+
# @return [Hash]
|
65
|
+
def update_auto_vpn_settings(network_id, options)
|
66
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
67
|
+
|
68
|
+
|
69
|
+
res = self.make_api_call("/networks/#{network_id}/siteToSiteVpn", 'PUT', options)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Get all MS access policies configured for a specific Dashboard network
|
73
|
+
# @param [String] network_id dashboard network ID to get MS policies for
|
74
|
+
# @return [Array] an array of hashes for containing the policy information
|
75
|
+
def get_ms_access_policies(network_id)
|
76
|
+
res = self.make_api_call("/networks/#{network_id}/accessPolicies", 'GET')
|
77
|
+
return res
|
78
|
+
end
|
79
|
+
|
80
|
+
# Bind a single network to a configuration template
|
81
|
+
# @param [String] network_id the source network that you want to bind to a tempalte
|
82
|
+
# @param [Hash] options options hash that contains configTemplateId and autoBind values. Refer to the official
|
83
|
+
# Meraki Dashboard API documentation for more information on these.
|
84
|
+
# @return [Integer] HTTP Code
|
85
|
+
def bind_network_to_template(network_id, options)
|
86
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
87
|
+
|
88
|
+
|
89
|
+
self.make_api_call("/networks/#{network_id}/bind", 'POST', options)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Unbind a single network from a configuration template
|
93
|
+
# @param [String] network_id the network that you want to unbind from it's template
|
94
|
+
# @return [Integer] HTTP Code
|
95
|
+
def unbind_network_to_template(network_id)
|
96
|
+
self.make_api_call("/networks/#{network_id}/unbind", 'POST')
|
97
|
+
end
|
98
|
+
|
99
|
+
# Return traffic analysis data for a network
|
100
|
+
# @param [String] network_id network that you want data for
|
101
|
+
# @param [Hash] options options hash containing a timespan and deviceType. Refer to the official
|
102
|
+
# Meraki Dashboard API documentation for more information on these.
|
103
|
+
def traffic_analysis(network_id, options)
|
104
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
105
|
+
|
106
|
+
self.make_api_call("/networks/#{network_id}/traffic", 'GET', options)
|
107
|
+
end
|
108
|
+
end
|
data/lib/organizations.rb
CHANGED
@@ -1,115 +1,110 @@
|
|
1
|
-
# Organization section of the Meraki Dashboard API
|
2
|
-
# @author Joe Letizia
|
3
|
-
module Organizations
|
4
|
-
# Returns information about an organization
|
5
|
-
# @param [String] org_id dashboard organization ID
|
6
|
-
# @return [Hash] results contains the org id and name of the given organization
|
7
|
-
def get_organization(org_id)
|
8
|
-
self.make_api_call("/organizations/#{org_id}", 'GET')
|
9
|
-
end
|
10
|
-
|
11
|
-
# Returns the current license state for a given organization
|
12
|
-
# @param [String] org_id dashboard organization ID
|
13
|
-
# @return [Hash] results contains the current license state information
|
14
|
-
def get_license_state(org_id)
|
15
|
-
self.make_api_call("/organizations/#{org_id}/licenseState", 'GET')
|
16
|
-
end
|
17
|
-
|
18
|
-
# Returns the current inventory for an organization
|
19
|
-
# @param [String] org_id dashboard organization ID
|
20
|
-
# @return [Array] an array of hashes containg information on each individual device
|
21
|
-
def get_inventory(org_id)
|
22
|
-
self.make_api_call("/organizations/#{org_id}/inventory", 'GET')
|
23
|
-
end
|
24
|
-
|
25
|
-
# Returns the current SNMP status for an organization
|
26
|
-
# @param [String] org_id dashboard organization ID
|
27
|
-
# @return [Hash] a hash containing all SNMP configuration information for an organization
|
28
|
-
def get_snmp_settings(org_id)
|
29
|
-
self.make_api_call("/organizations/#{org_id}/snmp", 'GET')
|
30
|
-
end
|
31
|
-
|
32
|
-
# Updates the current SNMP status for an organization
|
33
|
-
# @param [String] org_id dashboard organization ID
|
34
|
-
# @param [Hash] options a hash containing all updated SNMP configuration information for an organization. Please
|
35
|
-
# refer to official Dashboard API documentation for more information on these options: v2cEnabled, v3Enabled,
|
36
|
-
# v3AuthMode, v3AuthPass, v3PrivMode, v3PrivPass, peerIps
|
37
|
-
# @return [Hash] a hash containing all SNMP configuration information for an organization
|
38
|
-
def update_snmp_settings(org_id, options)
|
39
|
-
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
40
|
-
|
41
|
-
|
42
|
-
self.make_api_call("/organizations/#{org_id}/snmp", 'PUT', options)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Returns the configurations for an organizations 3rd party VPN peers
|
46
|
-
# @param [String] org_id dashboard organization ID
|
47
|
-
# @return [Array] an arrry of hashes containing the configuration information
|
48
|
-
# for each 3rd party VPN peer
|
49
|
-
def get_third_party_peers(org_id)
|
50
|
-
self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'GET')
|
51
|
-
end
|
52
|
-
|
53
|
-
# Updates your third party peers
|
54
|
-
# @param [String] org_id dashboard organization ID
|
55
|
-
# @params [Array] options An array of Hashes representing all configured third party peer. Takes the keys of name,
|
56
|
-
# publicIp, privateSubnets and secret
|
57
|
-
# @return [Array] returns the array of hashes for all currently configured 3rd party peers
|
58
|
-
def update_third_party_peers(org_id, options)
|
59
|
-
raise 'Options were not passed as
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
#
|
72
|
-
# @param [
|
73
|
-
# @
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
#
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
#
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
#
|
104
|
-
# @
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
options = {:body => options}
|
113
|
-
self.make_api_call("/organizations/#{org_id}/claim", 'POST', options)
|
114
|
-
end
|
115
|
-
end
|
1
|
+
# Organization section of the Meraki Dashboard API
|
2
|
+
# @author Joe Letizia
|
3
|
+
module Organizations
|
4
|
+
# Returns information about an organization
|
5
|
+
# @param [String] org_id dashboard organization ID
|
6
|
+
# @return [Hash] results contains the org id and name of the given organization
|
7
|
+
def get_organization(org_id)
|
8
|
+
self.make_api_call("/organizations/#{org_id}", 'GET')
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the current license state for a given organization
|
12
|
+
# @param [String] org_id dashboard organization ID
|
13
|
+
# @return [Hash] results contains the current license state information
|
14
|
+
def get_license_state(org_id)
|
15
|
+
self.make_api_call("/organizations/#{org_id}/licenseState", 'GET')
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the current inventory for an organization
|
19
|
+
# @param [String] org_id dashboard organization ID
|
20
|
+
# @return [Array] an array of hashes containg information on each individual device
|
21
|
+
def get_inventory(org_id)
|
22
|
+
self.make_api_call("/organizations/#{org_id}/inventory", 'GET')
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the current SNMP status for an organization
|
26
|
+
# @param [String] org_id dashboard organization ID
|
27
|
+
# @return [Hash] a hash containing all SNMP configuration information for an organization
|
28
|
+
def get_snmp_settings(org_id)
|
29
|
+
self.make_api_call("/organizations/#{org_id}/snmp", 'GET')
|
30
|
+
end
|
31
|
+
|
32
|
+
# Updates the current SNMP status for an organization
|
33
|
+
# @param [String] org_id dashboard organization ID
|
34
|
+
# @param [Hash] options a hash containing all updated SNMP configuration information for an organization. Please
|
35
|
+
# refer to official Dashboard API documentation for more information on these options: v2cEnabled, v3Enabled,
|
36
|
+
# v3AuthMode, v3AuthPass, v3PrivMode, v3PrivPass, peerIps
|
37
|
+
# @return [Hash] a hash containing all SNMP configuration information for an organization
|
38
|
+
def update_snmp_settings(org_id, options)
|
39
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
40
|
+
|
41
|
+
|
42
|
+
self.make_api_call("/organizations/#{org_id}/snmp", 'PUT', options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns the configurations for an organizations 3rd party VPN peers
|
46
|
+
# @param [String] org_id dashboard organization ID
|
47
|
+
# @return [Array] an arrry of hashes containing the configuration information
|
48
|
+
# for each 3rd party VPN peer
|
49
|
+
def get_third_party_peers(org_id)
|
50
|
+
self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'GET')
|
51
|
+
end
|
52
|
+
|
53
|
+
# Updates your third party peers
|
54
|
+
# @param [String] org_id dashboard organization ID
|
55
|
+
# @params [Array] options An array of Hashes representing all configured third party peer. Takes the keys of name,
|
56
|
+
# publicIp, privateSubnets and secret
|
57
|
+
# @return [Array] returns the array of hashes for all currently configured 3rd party peers
|
58
|
+
def update_third_party_peers(org_id, options)
|
59
|
+
raise 'Options were not passed as an Array' if !options.is_a?(Array)
|
60
|
+
|
61
|
+
self.make_api_call("/organizations/#{org_id}/thirdPartyVPNPeers", 'PUT', options)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns all organizations a user is an administrator on
|
65
|
+
# @return [Array] an array of hashes containing the organizations and their attributes
|
66
|
+
def list_all_organizations
|
67
|
+
self.make_api_call("/organizations", 'GET')
|
68
|
+
end
|
69
|
+
|
70
|
+
# Update an organization
|
71
|
+
# @param [String] org_id the organization ID that you want to update
|
72
|
+
# @param [Hash] options an options hash containing the org ID and new name of the org
|
73
|
+
# @return [Hash] the updated attributes of the organization
|
74
|
+
def update_organization(org_id, options)
|
75
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
76
|
+
|
77
|
+
self.make_api_call("/organizations/#{org_id}", 'PUT', options)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Create a new organization
|
81
|
+
# @param [Hash] options an options hash containing the name of the new organization
|
82
|
+
# @return [Hash] the attributes of the newly created organization
|
83
|
+
def create_organization(options)
|
84
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
85
|
+
|
86
|
+
self.make_api_call("/organizations", 'POST', options)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Clone an organization
|
90
|
+
# @param [String] source_org_id the source organization that we want to clone from
|
91
|
+
# @param [Hash] options options hash containing the attributes for the new organization
|
92
|
+
# @return [Hash] the attributes of the newly cloned organization
|
93
|
+
def clone_organization(source_org_id, options)
|
94
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
95
|
+
|
96
|
+
self.make_api_call("/organizations/#{source_org_id}/clone", 'POST', options)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Claim something
|
100
|
+
# @param [String] org_id the organization that you want to claim to
|
101
|
+
# @param [Hash] options a hash containing information about what you want to claim. This can be order,
|
102
|
+
# serial, licenseKey and licenseMode. Refer to the official Dashboard API documentation for more information
|
103
|
+
# about these
|
104
|
+
# @return [Integer] HTTP Code
|
105
|
+
def claim(org_id, options)
|
106
|
+
raise 'Options were not passed as a Hash' if !options.is_a?(Hash)
|
107
|
+
|
108
|
+
self.make_api_call("/organizations/#{org_id}/claim", 'POST', options)
|
109
|
+
end
|
110
|
+
end
|