xclarity_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE +201 -0
- data/README.md +51 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/mock_server.ru +11 -0
- data/bin/setup +8 -0
- data/docs/apib/aicc.apib +344 -0
- data/docs/apib/chassis.apib +1440 -0
- data/docs/apib/node.apib +890 -0
- data/example/simple.rb +15 -0
- data/lib/xclarity_client.rb +10 -0
- data/lib/xclarity_client/chassis.rb +7 -0
- data/lib/xclarity_client/client.rb +13 -0
- data/lib/xclarity_client/configuration.rb +14 -0
- data/lib/xclarity_client/node.rb +104 -0
- data/lib/xclarity_client/version.rb +3 -0
- data/lib/xclarity_client/virtual_appliance_management.rb +76 -0
- data/lib/xclarity_client/xclarity_base.rb +26 -0
- data/xclarity_client.gemspec +27 -0
- metadata +152 -0
data/example/simple.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'xclarity_client'
|
2
|
+
|
3
|
+
conf = XClarityClient::Configuration.new(
|
4
|
+
:username => 'admin',
|
5
|
+
:password => 'pass',
|
6
|
+
:host => 'http://localhost:9292'
|
7
|
+
)
|
8
|
+
|
9
|
+
virtual_appliance = XClarityClient::VirtualApplianceManagement.new(conf)
|
10
|
+
|
11
|
+
# puts virtual_appliance.configuration_settings
|
12
|
+
|
13
|
+
client = XClarityClient::Client.new(conf)
|
14
|
+
|
15
|
+
puts client.discover_nodes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require "xclarity_client/version"
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'xclarity_client/configuration'
|
7
|
+
require 'xclarity_client/client'
|
8
|
+
require 'xclarity_client/xclarity_base'
|
9
|
+
require 'xclarity_client/virtual_appliance_management'
|
10
|
+
require 'xclarity_client/node'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class Configuration
|
3
|
+
|
4
|
+
attr_accessor :username, :password, :host
|
5
|
+
|
6
|
+
def initialize(args)
|
7
|
+
args.each { |key, value| send("#{key}=", value) }
|
8
|
+
|
9
|
+
unless username && password && host
|
10
|
+
raise ArgumentError, "username, password, and host must all be specified"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class Node < XClarityBase
|
5
|
+
|
6
|
+
BASE_URI = '/nodes'.freeze
|
7
|
+
|
8
|
+
# accessState
|
9
|
+
# activationKeys
|
10
|
+
# addinCardSlots
|
11
|
+
# addinCards
|
12
|
+
# arch
|
13
|
+
# backedBy
|
14
|
+
# bladeState
|
15
|
+
# bootMode
|
16
|
+
# bootOrder
|
17
|
+
# cmmDisplayName
|
18
|
+
# cmmHealthState
|
19
|
+
# complexID
|
20
|
+
# contact
|
21
|
+
# dataHandle
|
22
|
+
# description
|
23
|
+
# dnsHostnames
|
24
|
+
# domainName
|
25
|
+
# driveBays
|
26
|
+
# drives
|
27
|
+
# embeddedHypervisorPresence
|
28
|
+
# encapsulation
|
29
|
+
# errorFields
|
30
|
+
# excludedHealthState
|
31
|
+
# expansionCardSlots
|
32
|
+
# expansionCards
|
33
|
+
# expansionProductType
|
34
|
+
# expansionProducts
|
35
|
+
# firmware
|
36
|
+
# flashStorage
|
37
|
+
# FRU
|
38
|
+
# fruSerialNumber
|
39
|
+
# hasOS
|
40
|
+
# height
|
41
|
+
# hostMacAddresses
|
42
|
+
# hostname
|
43
|
+
# ipInterfaces
|
44
|
+
# ipv4Addresses
|
45
|
+
# ipv6Addresses
|
46
|
+
# isConnectionTrusted
|
47
|
+
# isITME
|
48
|
+
# isRemotePresenceEnabled
|
49
|
+
# isScalable
|
50
|
+
# lanOverUsb
|
51
|
+
# leds
|
52
|
+
# location
|
53
|
+
# macAddress
|
54
|
+
# machineType
|
55
|
+
# manufacturer
|
56
|
+
# manufacturerId
|
57
|
+
# memoryModules
|
58
|
+
# memorySlots
|
59
|
+
# mgmtProcIPaddress
|
60
|
+
# model
|
61
|
+
# name
|
62
|
+
# nist
|
63
|
+
# onboardPciDevices
|
64
|
+
# overallHealthState
|
65
|
+
# partNumber
|
66
|
+
# partitionID
|
67
|
+
# pciCapabilities
|
68
|
+
# pciDevices
|
69
|
+
# ports
|
70
|
+
# posID
|
71
|
+
# powerAllocation
|
72
|
+
# powerCappingPolicy
|
73
|
+
# powerStatus
|
74
|
+
# powerSupplies
|
75
|
+
# processorSlots
|
76
|
+
# processors
|
77
|
+
# productId
|
78
|
+
# productName
|
79
|
+
# raidSettings
|
80
|
+
# secureBootMode
|
81
|
+
# serialNumber
|
82
|
+
# slots
|
83
|
+
# status
|
84
|
+
# subSlots
|
85
|
+
# subType
|
86
|
+
# tlsVersion
|
87
|
+
# type
|
88
|
+
# uri
|
89
|
+
# userDescription
|
90
|
+
# uuid
|
91
|
+
# vnicMode
|
92
|
+
# vpdID
|
93
|
+
|
94
|
+
def initialize(conf)
|
95
|
+
super(conf, BASE_URI)
|
96
|
+
end
|
97
|
+
|
98
|
+
def populate
|
99
|
+
response = connection(BASE_URI)
|
100
|
+
response.body
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module XClarityClient
|
2
|
+
class VirtualApplianceManagement < XClarityBase
|
3
|
+
|
4
|
+
BASE_URI = '/aicc'.freeze
|
5
|
+
NETWORK_URI = '/network'.freeze
|
6
|
+
IPDISABLE_URI = '/ipdisable'.freeze
|
7
|
+
HOST_URI = '/host'.freeze
|
8
|
+
INTERFACES_URI = '/interfaces'.freeze
|
9
|
+
ROUTES_URI = '/routes'.freeze
|
10
|
+
SUBSCRIPTIONS_URI = '/subscriptions'.freeze
|
11
|
+
|
12
|
+
def initialize(conf)
|
13
|
+
super(conf, BASE_URI)
|
14
|
+
end
|
15
|
+
|
16
|
+
def configuration_settings
|
17
|
+
response = connection
|
18
|
+
response
|
19
|
+
end
|
20
|
+
|
21
|
+
def configuration_settings=()
|
22
|
+
end
|
23
|
+
|
24
|
+
def ip_enablement_state
|
25
|
+
uri = BASE_URI+NETWORK_URI+IPDISABLE_URI
|
26
|
+
response = connection(uri)
|
27
|
+
response
|
28
|
+
end
|
29
|
+
|
30
|
+
def ip_enablement_state=()
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def host_settings
|
35
|
+
uri = BASE_URI+NETWORK_URI+IPDISABLE_URI
|
36
|
+
response = connection(uri)
|
37
|
+
response
|
38
|
+
end
|
39
|
+
|
40
|
+
def host_settings=()
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def network_interface_settings(interface)
|
45
|
+
uri = BASE_URI+NETWORK_URI+INTERFACES_URI+"/#{interface}"
|
46
|
+
response = connection(uri)
|
47
|
+
response
|
48
|
+
end
|
49
|
+
|
50
|
+
def host_settings=()
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def route_settings
|
55
|
+
uri = BASE_URI+NETWORK_URI+ROUTES_URI
|
56
|
+
response = connection(uri)
|
57
|
+
response
|
58
|
+
end
|
59
|
+
|
60
|
+
def route_settings=()
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def subscriptions
|
65
|
+
uri = BASE_URI+SUBSCRIPTIONS_URI
|
66
|
+
response = connection(uri)
|
67
|
+
response
|
68
|
+
end
|
69
|
+
|
70
|
+
def subscriptions=()
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
3
|
+
module XClarityClient
|
4
|
+
class XClarityBase
|
5
|
+
|
6
|
+
attr_reader :conn
|
7
|
+
|
8
|
+
def initialize(conf, uri)
|
9
|
+
connection_builder(conf, uri)
|
10
|
+
end
|
11
|
+
|
12
|
+
def connection_builder(conf, uri)
|
13
|
+
@conn = Faraday.new(url: conf.host + uri) do |faraday|
|
14
|
+
faraday.request :url_encoded # form-encode POST params
|
15
|
+
faraday.response :logger # log requests to STDOUT
|
16
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def connection(uri = "", options = {})
|
23
|
+
@conn.get(uri)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'xclarity_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xclarity_client"
|
8
|
+
spec.version = XClarityClient::VERSION
|
9
|
+
spec.authors = ["Julian Cheal"]
|
10
|
+
spec.email = ["jcheal@redhat.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Write a short summary, because Rubygems requires one.}
|
13
|
+
spec.description = %q{Write a longer description or delete this line.}
|
14
|
+
spec.homepage = "https://github.com/juliancheal/xclarity_client"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
24
|
+
spec.add_development_dependency "apib-mock_server", "~> 1.0.3"
|
25
|
+
spec.add_development_dependency "webmock", "~> 2.1.0"
|
26
|
+
spec.add_dependency "faraday", "~> 0.9.2"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xclarity_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julian Cheal
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: apib-mock_server
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.3
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.0.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.2
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.9.2
|
97
|
+
description: Write a longer description or delete this line.
|
98
|
+
email:
|
99
|
+
- jcheal@redhat.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/console
|
113
|
+
- bin/mock_server.ru
|
114
|
+
- bin/setup
|
115
|
+
- docs/apib/aicc.apib
|
116
|
+
- docs/apib/chassis.apib
|
117
|
+
- docs/apib/node.apib
|
118
|
+
- example/simple.rb
|
119
|
+
- lib/xclarity_client.rb
|
120
|
+
- lib/xclarity_client/chassis.rb
|
121
|
+
- lib/xclarity_client/client.rb
|
122
|
+
- lib/xclarity_client/configuration.rb
|
123
|
+
- lib/xclarity_client/node.rb
|
124
|
+
- lib/xclarity_client/version.rb
|
125
|
+
- lib/xclarity_client/virtual_appliance_management.rb
|
126
|
+
- lib/xclarity_client/xclarity_base.rb
|
127
|
+
- xclarity_client.gemspec
|
128
|
+
homepage: https://github.com/juliancheal/xclarity_client
|
129
|
+
licenses: []
|
130
|
+
metadata: {}
|
131
|
+
post_install_message:
|
132
|
+
rdoc_options: []
|
133
|
+
require_paths:
|
134
|
+
- lib
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
requirements: []
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.6.3
|
148
|
+
signing_key:
|
149
|
+
specification_version: 4
|
150
|
+
summary: Write a short summary, because Rubygems requires one.
|
151
|
+
test_files: []
|
152
|
+
has_rdoc:
|