ucslib 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +151 -0
  3. data/README.rdoc +88 -101
  4. data/lib/ucslib/Gemfile +4 -0
  5. data/lib/ucslib/{destroy.rb → service/ucs/destroy.rb} +3 -12
  6. data/lib/ucslib/{inventory.rb → service/ucs/inventory.rb} +34 -31
  7. data/lib/ucslib/{manage.rb → service/ucs/manage.rb} +14 -22
  8. data/lib/ucslib/{parser.rb → service/ucs/parser.rb} +19 -19
  9. data/lib/ucslib/{provision.rb → service/ucs/provision.rb} +59 -66
  10. data/lib/ucslib/service/ucs/session.rb +110 -0
  11. data/lib/ucslib/{stats.rb → service/ucs/stats.rb} +21 -1
  12. data/lib/ucslib/service/ucs/ucs.rb +70 -0
  13. data/lib/ucslib/{update.rb → service/ucs/update.rb} +9 -17
  14. data/lib/ucslib/version.rb +2 -1
  15. data/lib/ucslib.rb +3 -8
  16. metadata +26 -71
  17. data/.gitignore +0 -4
  18. data/Gemfile +0 -4
  19. data/html/README_rdoc.html +0 -226
  20. data/html/UCSInventory.html +0 -533
  21. data/html/UCSProvision.html +0 -1914
  22. data/html/UCSToken.html +0 -338
  23. data/html/Ucslib.html +0 -173
  24. data/html/created.rid +0 -7
  25. data/html/images/brick.png +0 -0
  26. data/html/images/brick_link.png +0 -0
  27. data/html/images/bug.png +0 -0
  28. data/html/images/bullet_black.png +0 -0
  29. data/html/images/bullet_toggle_minus.png +0 -0
  30. data/html/images/bullet_toggle_plus.png +0 -0
  31. data/html/images/date.png +0 -0
  32. data/html/images/find.png +0 -0
  33. data/html/images/loadingAnimation.gif +0 -0
  34. data/html/images/macFFBgHack.png +0 -0
  35. data/html/images/package.png +0 -0
  36. data/html/images/page_green.png +0 -0
  37. data/html/images/page_white_text.png +0 -0
  38. data/html/images/page_white_width.png +0 -0
  39. data/html/images/plugin.png +0 -0
  40. data/html/images/ruby.png +0 -0
  41. data/html/images/tag_green.png +0 -0
  42. data/html/images/wrench.png +0 -0
  43. data/html/images/wrench_orange.png +0 -0
  44. data/html/images/zoom.png +0 -0
  45. data/html/index.html +0 -273
  46. data/html/js/darkfish.js +0 -116
  47. data/html/js/jquery.js +0 -32
  48. data/html/js/quicksearch.js +0 -114
  49. data/html/js/thickbox-compressed.js +0 -10
  50. data/html/lib/ucslib/inventory_rb.html +0 -75
  51. data/html/lib/ucslib/provision_rb.html +0 -75
  52. data/html/lib/ucslib/session_rb.html +0 -75
  53. data/html/lib/ucslib/version_rb.html +0 -75
  54. data/html/lib/ucslib_rb.html +0 -89
  55. data/html/rdoc.css +0 -763
  56. data/lib/ucslib/session.rb +0 -108
  57. data/ucslib.gemspec +0 -45
@@ -1,108 +0,0 @@
1
- # Author:: Murali Raju (<murali.raju@appliv.com>)
2
- # Copyright:: Copyright (c) 2012 Murali Raju.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- #UCSM API Session management
19
-
20
-
21
- class UCSToken
22
- #Accept a JSON object that contains the UCSM username, password, and IP
23
- def get_token(authjson)
24
-
25
- username = "#{JSON.parse(authjson)['username']}"
26
- password = "#{JSON.parse(authjson)['password']}"
27
- ip = "#{JSON.parse(authjson)['ip']}"
28
- url = "https://#{ip}/nuova"
29
-
30
- xml_builder = Nokogiri::XML::Builder.new do |xml|
31
- xml.aaaLogin('inName' => username, 'inPassword' => password)
32
- end
33
- aaa_login_xml = xml_builder.to_xml.to_s
34
- ucs_response = RestClient.post(url, aaa_login_xml, :content_type => 'text/xml').body
35
- ucs_login_doc = Nokogiri::XML(ucs_response)
36
- ucs_login_root = ucs_login_doc.root
37
- cookie = ucs_login_root.attributes['outCookie']
38
-
39
- begin
40
- return session = { :cookie => "#{cookie}",
41
- :username => "#{username}",
42
- :password => "#{password}",
43
- :ip => "#{ip}" }.to_json
44
- rescue Exception => e
45
- 'An Error Occured. Please check authentication credentials'
46
- else
47
- Process.exit
48
- end
49
-
50
- end
51
-
52
-
53
- def refresh_token(tokenjson)
54
-
55
- cookie = "#{JSON.parse(tokenjson)['cookie']}"
56
- username = "#{JSON.parse(tokenjson)['username']}"
57
- password = "#{JSON.parse(tokenjson)['password']}"
58
- ip = "#{JSON.parse(tokenjson)['ip']}"
59
- url = "https://#{ip}/nuova"
60
-
61
-
62
- xml_builder = Nokogiri::XML::Builder.new do |xml|
63
- xml.aaaRefresh('inName' => username, 'inPassword' => password, 'inCookie' => cookie)
64
- end
65
- aaa_refresh_xml = xml_builder.to_xml.to_s
66
-
67
- ucs_response = RestClient.post(url, aaa_refresh_xml, :content_type => 'text/xml').body
68
-
69
-
70
- ucs_login_doc = Nokogiri::XML(ucs_response)
71
- ucs_login_root = ucs_login_doc.root
72
- new_cookie = ucs_login_root.attributes['outCookie']
73
-
74
- begin
75
- #return ucs_session json containing new cookie, url, ip
76
- return session = { :cookie => "#{new_cookie}",
77
- :username => "#{username}",
78
- :password => "#{password}",
79
- :ip => "#{ip}" }.to_json
80
- rescue Exception => e
81
- 'An Error Occured. Please check authentication credentials'
82
- else
83
- Process.exit
84
- end
85
-
86
- end
87
-
88
- def logout(tokenjson)
89
-
90
- cookie = "#{JSON.parse(tokenjson)['cookie']}"
91
- ip = "#{JSON.parse(tokenjson)['ip']}"
92
- url = "https://#{ip}/nuova"
93
-
94
- xml_builder = Nokogiri::XML::Builder.new do |xml|
95
- xml.aaaLogout('inCookie' => cookie)
96
- end
97
-
98
- aaaLogoutXML = xml_builder.to_xml.to_s
99
-
100
- begin
101
- RestClient.post(url, aaaLogoutXML, :content_type => 'text/xml').body
102
- rescue Exception => e
103
- raise "Error #{e}"
104
- end
105
-
106
- end
107
-
108
- end
data/ucslib.gemspec DELETED
@@ -1,45 +0,0 @@
1
- # Author:: Murali Raju (<murali.raju@appliv.com>)
2
- # Copyright:: Copyright (c) 2011 Murali Raju.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- # -*- encoding: utf-8 -*-
19
- $:.push File.expand_path("../lib", __FILE__)
20
- require "ucslib/version"
21
-
22
- Gem::Specification.new do |s|
23
- s.name = "ucslib"
24
- s.version = Ucslib::VERSION
25
- s.authors = ["Murali Raju"]
26
- s.email = ["murali.raju@appliv.com"]
27
- s.homepage = ""
28
- s.summary = %q{Ruby UCS Manager Client Library}
29
- s.description = %q{Ruby Client Library for Cisco UCS Manager that can be used by DevOps toolchains (Chef/Puppet or others) to provide hardware deployment automation}
30
-
31
- s.rubyforge_project = "ucslib"
32
-
33
- s.files = `git ls-files`.split("\n")
34
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
35
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
36
- s.require_paths = ["lib"]
37
-
38
- # specify any dependencies here; for example:
39
- # s.add_development_dependency "rspec"
40
- # s.add_runtime_dependency "rest-client"
41
-
42
- s.add_dependency("nokogiri")
43
- s.add_dependency("rest-client")
44
- s.add_dependency("json")
45
- end