junos-space-api 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -36,6 +36,13 @@ Check out the [Wiki][1] for documentation on the different Classes and their res
36
36
 
37
37
  Check out the `examples` directory to browse through some samples of what this API can do!
38
38
 
39
+ ### Credits
40
+
41
+ Thanks to [Jeremy Schulman][3] for inspiration and help with all the automation-goodness! And thanks
42
+ to [Juniper Networks][4] for creating such great products :)
43
+
39
44
 
40
45
  [1]: https://github.com/scottdware/junos-ruby-space-api/wiki
41
- [2]: http://www.juniper.net/techpubs/en_US/junos-space13.1/information-products/topic-collections/junos-space-security-designer/security-director-api.pdf
46
+ [2]: http://www.juniper.net/techpubs/en_US/junos-space13.1/information-products/topic-collections/junos-space-security-designer/security-director-api.pdf
47
+ [3]: https://github.com/jeremyschulman
48
+ [4]: http://www.juniper.net
@@ -16,4 +16,4 @@ data = {
16
16
  }
17
17
 
18
18
  # Will return the job ID (i.e. {"status"=>"9990001"}
19
- pp devices.add_device(data)
19
+ pp devices.add(data)
@@ -17,13 +17,13 @@ data = {
17
17
  }
18
18
 
19
19
  # Will get a list of all of the address objects.
20
- pp addrs.addresses
20
+ pp addrs.list
21
21
 
22
22
  # Will add a new address object to Junos Space.
23
- pp addrs.add_address(data)
23
+ pp addrs.add(data)
24
24
 
25
25
  # Will return information about the address object.
26
- pp addrs.address_info('my-home-network')
26
+ pp addrs.info('my-home-network')
27
27
 
28
28
  # Will delete the address object.
29
- pp addrs.delete_address('my-home-network')
29
+ pp addrs.delete('my-home-network')
@@ -9,10 +9,10 @@ JunosSpace.open('user', 'pass', 'server')
9
9
  jobs = JunosSpace::Platform::Job.new
10
10
 
11
11
  # Will return all jobs with a status of SUCCESS
12
- pp jobs.jobs('success')
12
+ pp jobs.list('success')
13
13
 
14
14
  # Will return all jobs with a status of FAILURE
15
- pp jobs.jobs('failure')
15
+ pp jobs.list('failure')
16
16
 
17
17
  # Will return information about the job ID 9990001
18
- pp jobs.job_info('9990001')
18
+ pp jobs.info('9990001')
@@ -6,7 +6,7 @@ pass = 'somepass'
6
6
  server = 'space.company.com'
7
7
 
8
8
  JunosSpace.open('user', 'pass', 'server')
9
- secdev = JunosSpace::SD::Device.new
9
+ security = JunosSpace::SD::Device.new
10
10
 
11
11
  # Will return the security device information (i.e. zones, interfaces, etc.)
12
- pp secdev.device_info('corporate-firewall')
12
+ pp security.info('corporate-firewall')
@@ -14,13 +14,13 @@ data = {
14
14
  }
15
15
 
16
16
  # Will get a list of all of the services.
17
- pp services.services
17
+ pp services.list
18
18
 
19
19
  # Will add a new service object to Junos Space.
20
- pp services.add_service(data)
20
+ pp services.add(data)
21
21
 
22
22
  # Will return information about the service object.
23
- pp services.service_info('my-custom-service')
23
+ pp services.info('my-custom-service')
24
24
 
25
25
  # Will delete the service object.
26
- pp services.delete_service('my-custom-service')
26
+ pp services.delete('my-custom-service')
Binary file
@@ -3,7 +3,7 @@ require 'rake'
3
3
  Gem::Specification.new do |s|
4
4
  s.license = 'MIT'
5
5
  s.name = 'junos-space-api'
6
- s.version = '0.2.0'
6
+ s.version = '0.2.1'
7
7
  s.summary = 'Interact with the Junos Space REST API.'
8
8
  s.description = 'This gem is used to interact with Juniper Networks Junos Space management platform using the REST API.'
9
9
  s.authors = ["Scott Ware"]
@@ -12,17 +12,15 @@ class JunosSpace::Platform::Device
12
12
  @@queue_headers = {
13
13
  :content_type => 'application/hornetq.jms.queue+xml'
14
14
  }
15
- @@ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
16
- @@dcase = 'abcdefghijklmnopqrstuvwxyz'
17
15
 
18
- # devices
16
+ # list
19
17
  #
20
18
  # Returns a Hash of all of the devices in the Junos Space database. The
21
19
  # device name is the key, and value is an array of the following:
22
20
  # device id, family, Junos version, platform, serial number,
23
21
  # connection status, IP address, and managed status.
24
22
  #
25
- def devices
23
+ def list
26
24
  result = {}
27
25
 
28
26
  begin
@@ -51,7 +49,7 @@ class JunosSpace::Platform::Device
51
49
  end
52
50
  end
53
51
 
54
- # add_device(data)
52
+ # add(data)
55
53
  #
56
54
  # Add a new device to the Junos Space database, with the given information
57
55
  # in 'data'. 'data' is a Hash table with the following structure:
@@ -63,7 +61,7 @@ class JunosSpace::Platform::Device
63
61
  #
64
62
  # Returns a Hash with 'status' as the key, and the job ID as the value.
65
63
  #
66
- def add_device(data)
64
+ def add(data)
67
65
  result = {}
68
66
 
69
67
  begin
@@ -7,14 +7,14 @@ class JunosSpace::Platform::Job
7
7
  @@ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
8
8
  @@dcase = 'abcdefghijklmnopqrstuvwxyz'
9
9
 
10
- # jobs(status)
10
+ # list(status)
11
11
  #
12
12
  # Returns a Hash of all of the jobs in Space with the status
13
13
  # 'status'. Where 'status' can be one of: 'success', 'failure',
14
14
  # 'inprogress', or 'cancelled'. If no status is given, then all of the jobs are
15
15
  # returned. The name of the job is the key, and the ID is the value.
16
16
  #
17
- def jobs(status)
17
+ def list(status)
18
18
  result = {}
19
19
 
20
20
  begin
@@ -49,13 +49,13 @@ class JunosSpace::Platform::Job
49
49
  end
50
50
  end
51
51
 
52
- # job_info(job)
52
+ # info(job)
53
53
  #
54
54
  # Returns information about the job 'job'. This information is returned in a Hash
55
55
  # with the job ID, name, percentage complete, status, job type, summary, user
56
56
  # who issued the job, and the time the job was started.
57
57
  #
58
- def job_info(job)
58
+ def info(job)
59
59
  result = {}
60
60
 
61
61
  begin
@@ -10,12 +10,12 @@ class JunosSpace::SD::Address
10
10
  @@ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
11
11
  @@dcase = 'abcdefghijklmnopqrstuvwxyz'
12
12
 
13
- # addresses
13
+ # list
14
14
  #
15
15
  # Returns a Hash of all of the address objects in Space. The name
16
16
  # of the object is the key, and the ID is the value.
17
17
  #
18
- def addresses
18
+ def list
19
19
  result = {}
20
20
 
21
21
  begin
@@ -37,14 +37,14 @@ class JunosSpace::SD::Address
37
37
  end
38
38
  end
39
39
 
40
- # address_info(name)
40
+ # info(name)
41
41
  #
42
42
  # Searches for address object 'name' and returns a Hash with the address
43
43
  # object(s) name as the key, and the IP address as the value.
44
44
  # If the address object(s) are a group, then the value within
45
45
  # the Hash is an array of the address object names within the group(s).
46
46
  #
47
- def address_info(name)
47
+ def info(name)
48
48
  result = {}
49
49
 
50
50
  begin
@@ -88,7 +88,7 @@ class JunosSpace::SD::Address
88
88
  end
89
89
  end
90
90
 
91
- # add_address(data)
91
+ # add(data)
92
92
  #
93
93
  # This method will add a new address object to Space give the information
94
94
  # in 'data'. This information is a Hash with the following structure:
@@ -99,10 +99,11 @@ class JunosSpace::SD::Address
99
99
  # `desc => Description (optional)`,
100
100
  # `version => Either 'v4' or 'v6'`
101
101
  #
102
- def add_address(data)
103
- result = {}
104
- type = data['type'] == 'address' ? 'IPADDRESS' : 'NETWORK'
102
+ def add(data)
103
+ result = {}
104
+ type = data['type'] == 'address' ? 'IPADDRESS' : 'NETWORK'
105
105
  version = data['version'] == 'v4' ? 'IPV4' : 'IPV6'
106
+
106
107
  if data['desc']
107
108
  desc = data['desc']
108
109
  else
@@ -133,13 +134,13 @@ class JunosSpace::SD::Address
133
134
  end
134
135
  end
135
136
 
136
- # delete_address(name)
137
+ # delete(name)
137
138
  #
138
139
  # Deletes the object matching the name 'name'. If more than one address object
139
140
  # is found during the search, then send a warning to refine the search (i.e.
140
141
  # use the exact name if possible).
141
142
  #
142
- def delete_address(name)
143
+ def delete(name)
143
144
  result = {}
144
145
 
145
146
  begin
@@ -5,12 +5,12 @@ require 'junos-space-api/space'
5
5
  class JunosSpace::SD::Device
6
6
  @@device_uri = '/api/juniper/sd/device-management/devices'
7
7
 
8
- # devices
8
+ # list
9
9
  #
10
10
  # Returns a Hash of all of the device objects in Space. The name
11
11
  # of the device is the key, and the ID is the value.
12
12
  #
13
- def devices
13
+ def list
14
14
  result = {}
15
15
 
16
16
  begin
@@ -32,7 +32,7 @@ class JunosSpace::SD::Device
32
32
  end
33
33
  end
34
34
 
35
- # device_info(name)
35
+ # info(name)
36
36
  #
37
37
  # Returns a Hash of resultrmation about the given device 'name'. For zones,
38
38
  # it returns Hash where the zone name is the key, and an array of interfaces
@@ -41,9 +41,9 @@ class JunosSpace::SD::Device
41
41
  # For interfaces, it returns a Hash where the interface name is the key, and
42
42
  # the IP address of that interface is the value.
43
43
  #
44
- def device_info(name)
44
+ def info(name)
45
45
  result = {}
46
- devices = self.devices
46
+ devices = self.list
47
47
 
48
48
  begin
49
49
  res = RestClient.get("#{JunosSpace.base_uri}#{@@device_uri}/#{devices[name]}")
@@ -10,12 +10,12 @@ class JunosSpace::SD::Service
10
10
  @@ucase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
11
11
  @@dcase = 'abcdefghijklmnopqrstuvwxyz'
12
12
 
13
- # services
13
+ # list
14
14
  #
15
15
  # Returns a Hash of all of the individual service objects in Space.
16
16
  # The name of the service is the key, and the ID is the value.
17
17
  #
18
- def services
18
+ def list
19
19
  result = {}
20
20
 
21
21
  begin
@@ -37,14 +37,14 @@ class JunosSpace::SD::Service
37
37
  end
38
38
  end
39
39
 
40
- # service_info(name)
40
+ # info(name)
41
41
  #
42
42
  # Searches for the service 'name' and returns a Hash with the service
43
43
  # object(s) name as the key, and the ID as the value.
44
44
  # If the service object(s) are a group, then the value within
45
45
  # the Hash is an array of the service object names within the group(s).
46
46
  #
47
- def service_info(name)
47
+ def info(name)
48
48
  result = {}
49
49
 
50
50
  begin
@@ -90,7 +90,7 @@ class JunosSpace::SD::Service
90
90
  end
91
91
  end
92
92
 
93
- # add_service(data)
93
+ # add(data)
94
94
  #
95
95
  # This method will add a new service object to Space give the information
96
96
  # in 'data'. This information is a Hash table, with the following structure:
@@ -99,7 +99,7 @@ class JunosSpace::SD::Service
99
99
  # `port => Port number`
100
100
  # `desc => Description (optional)`
101
101
  #
102
- def add_service(data)
102
+ def add(data)
103
103
  result = {}
104
104
 
105
105
  if data['desc']
@@ -135,13 +135,13 @@ class JunosSpace::SD::Service
135
135
  end
136
136
  end
137
137
 
138
- # delete_service(name)
138
+ # delete(name)
139
139
  #
140
140
  # Deletes the object matching the name 'name'. If more than one service object
141
141
  # is found during the search, then send a warning to refine the search (i.e.
142
142
  # use the exact name if possible).
143
143
  #
144
- def delete_service(name)
144
+ def delete(name)
145
145
  result = {}
146
146
 
147
147
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: junos-space-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-09 00:00:00.000000000 Z
12
+ date: 2013-07-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This gem is used to interact with Juniper Networks Junos Space management
15
15
  platform using the REST API.
@@ -18,6 +18,7 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - junos-space-api-0.2.0.gem
21
22
  - junos-space-api.gemspec
22
23
  - LICENSE
23
24
  - README.md