esod-client 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/README +5 -2
- data/VERSION +1 -1
- data/command_line_options.rb +19 -0
- data/esod-client.gemspec +5 -4
- data/esod-client.rb +7 -13
- data/lib/esod_client/esod_client.rb +0 -2
- metadata +3 -2
- data/pkg/esod-client-0.2.0.gem +0 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/*
|
data/README
CHANGED
@@ -3,8 +3,11 @@ A simple tool to execute REST requests against an ESOD instance.
|
|
3
3
|
|
4
4
|
== Examples ==
|
5
5
|
Retrieving a resource as a Hash:
|
6
|
-
./esod-client.rb -u http://elasticserver.com -r server -i 18779 -a c15052
|
6
|
+
./esod-client.rb -u http://elasticserver.com -r server -i 18779 -a c15052
|
7
7
|
|
8
8
|
Retrieving a property of a resource using dotted notation
|
9
9
|
./esod-client.rb -u http://localhost:3000 -r server -i 18779 -a c15052 -p "elastic_server.bundles.first.packages.first.display_name"
|
10
|
-
|
10
|
+
|
11
|
+
Retrieving a custom resource path
|
12
|
+
./esod-client.rb -u http://elasticserver.com -e api/admin/server/18779/iso -a c15052
|
13
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$options = Trollop::options do
|
2
|
+
banner <<-EOS
|
3
|
+
#{File.read('README')}
|
4
|
+
Options:
|
5
|
+
EOS
|
6
|
+
opt :url, "Base url of ESOD service", :required => true, :type => :string
|
7
|
+
opt :resource, "Resource to retrieve (ex: server)", :type => :string
|
8
|
+
opt :id, "Id of resource to retrieve (ex: 12345)", :type => :string
|
9
|
+
opt :resource_path, "Full resource path (instead of resource & id, ex: server/12345)", :type => :string
|
10
|
+
opt :property, "Property of the resource, dotted notation (ex: vm_configuration_parameters.first.name)", :type => :string, :required => false
|
11
|
+
opt :api_token, "User authentication token", :type => :string, :required => true
|
12
|
+
end
|
13
|
+
if $options[:resource] || $options[:id]
|
14
|
+
Trollop::die :resource_path, "cannot be specified if --resource and --id options are used. Use either --resource-path OR --resource and --id."
|
15
|
+
elsif $options[:resource_path]
|
16
|
+
if $options[:resource] || $options[:id]
|
17
|
+
Trollop::die :resource, "cannot be specified if --resource-path option is used. Use either --resource-path OR --resource and --id."
|
18
|
+
end
|
19
|
+
end
|
data/esod-client.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{esod-client}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Yan Pritzker", "CohesiveFT"]
|
@@ -17,12 +17,14 @@ Gem::Specification.new do |s|
|
|
17
17
|
"README.ruby"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
"
|
20
|
+
".gitignore",
|
21
|
+
"EXAMPLES",
|
21
22
|
"GEM_RELEASE",
|
22
23
|
"README",
|
23
24
|
"README.ruby",
|
24
25
|
"Rakefile",
|
25
26
|
"VERSION",
|
27
|
+
"command_line_options.rb",
|
26
28
|
"esod-client.gemspec",
|
27
29
|
"esod-client.rb",
|
28
30
|
"esodclient.rb",
|
@@ -100,8 +102,7 @@ Gem::Specification.new do |s|
|
|
100
102
|
"lib/rest-client-1.2.0/spec/resource_spec.rb",
|
101
103
|
"lib/rest-client-1.2.0/spec/response_spec.rb",
|
102
104
|
"lib/rest-client-1.2.0/spec/restclient_spec.rb",
|
103
|
-
"lib/trollop.rb"
|
104
|
-
"pkg/esod-client-0.2.0.gem"
|
105
|
+
"lib/trollop.rb"
|
105
106
|
]
|
106
107
|
s.homepage = %q{http://github.com/cohesive/esod-client}
|
107
108
|
s.rdoc_options = ["--charset=UTF-8"]
|
data/esod-client.rb
CHANGED
@@ -3,23 +3,17 @@
|
|
3
3
|
require 'lib/trollop'
|
4
4
|
require 'pp'
|
5
5
|
|
6
|
-
|
7
|
-
banner <<-EOS
|
8
|
-
#{File.read('README')}
|
9
|
-
Options:
|
10
|
-
EOS
|
11
|
-
opt :url, "Base url of ESOD service", :required => true, :type => :string
|
12
|
-
opt :resource, "Resource to retrieve (ex: server)", :type => :string, :required => true
|
13
|
-
opt :id, "Id of resource to retrieve (ex: 12345)", :type => :string, :required => true
|
14
|
-
opt :property, "Property of the resource, dotted notation (ex: vm_configuration_parameters.first.name)", :type => :string, :required => false
|
15
|
-
opt :api_token, "User authentication token", :type => :string, :required => true
|
16
|
-
end
|
17
|
-
|
6
|
+
require 'command_line_options'
|
18
7
|
require 'esodclient'
|
19
8
|
|
20
9
|
def main
|
21
10
|
client = ESODClient.new($options[:url], $options[:api_token])
|
22
|
-
|
11
|
+
|
12
|
+
response = if $options[:resource_path]
|
13
|
+
client.get_path($options[:resource_path])
|
14
|
+
else
|
15
|
+
client.get($options[:resource], $options[:id])
|
16
|
+
end
|
23
17
|
|
24
18
|
if $options[:property]
|
25
19
|
response = response.value_of_dotted_property($options[:property])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esod-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yan Pritzker
|
@@ -24,12 +24,14 @@ extra_rdoc_files:
|
|
24
24
|
- README
|
25
25
|
- README.ruby
|
26
26
|
files:
|
27
|
+
- .gitignore
|
27
28
|
- EXAMPLES
|
28
29
|
- GEM_RELEASE
|
29
30
|
- README
|
30
31
|
- README.ruby
|
31
32
|
- Rakefile
|
32
33
|
- VERSION
|
34
|
+
- command_line_options.rb
|
33
35
|
- esod-client.gemspec
|
34
36
|
- esod-client.rb
|
35
37
|
- esodclient.rb
|
@@ -108,7 +110,6 @@ files:
|
|
108
110
|
- lib/rest-client-1.2.0/spec/response_spec.rb
|
109
111
|
- lib/rest-client-1.2.0/spec/restclient_spec.rb
|
110
112
|
- lib/trollop.rb
|
111
|
-
- pkg/esod-client-0.2.0.gem
|
112
113
|
has_rdoc: true
|
113
114
|
homepage: http://github.com/cohesive/esod-client
|
114
115
|
licenses: []
|
data/pkg/esod-client-0.2.0.gem
DELETED
Binary file
|