mms-api 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/bin/mms-api +14 -3
- data/lib/mms/cache.rb +4 -0
- data/lib/mms/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f84b83712abb35d5ddc92349e7f7edc6ce8ce1d
|
4
|
+
data.tar.gz: 9402addd71a60272c9c7ec83b615f0dff43807b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b33d1456eb0dd74586cd4cae98fd2c58f943ce3232a37bf5dbe025c34d907af08cdb78bfa2badf6816bad4a88ddb5958459d658ac87a914e0ebf6cfb45e7e83
|
7
|
+
data.tar.gz: b06c7b7efc6826286ea196834b8e3bd99c3cabb61526283aaa4f68a1e9dba9c4e543290108af2f2b5239205abe6549a7ca9c26aaa9936360a764e95cbe7018b0
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
mms-api
|
1
|
+
mms-api [![Build Status](https://travis-ci.org/cargomedia/mms-api.png)](https://travis-ci.org/cargomedia/mms-api)
|
2
2
|
=======
|
3
3
|
Minimalistic [MMS API](http://mms.mongodb.com/) agent for ruby
|
4
4
|
|
@@ -33,6 +33,15 @@ Options:
|
|
33
33
|
-h, --help Show this help
|
34
34
|
```
|
35
35
|
|
36
|
+
`mms-api` reads default configuration from your home directory `~/.mms-api`. Example configuration:
|
37
|
+
|
38
|
+
```
|
39
|
+
username=sysadmin@example.tld
|
40
|
+
apikey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
41
|
+
# apiurl=https://mms.mydomain.tld/api/public/v1.0
|
42
|
+
# action=hosts
|
43
|
+
```
|
44
|
+
|
36
45
|
API coverage
|
37
46
|
------------
|
38
47
|
The MMS Public API follows the principles of the REST architectural style to expose a number of internal resources which enable programmatic access to [MMS’s features](http://mms.mongodb.com/help/reference/api/). Current implementation support only a few of API features.
|
data/bin/mms-api
CHANGED
@@ -5,7 +5,8 @@ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
|
5
5
|
require 'mms'
|
6
6
|
require 'optparse'
|
7
7
|
require 'terminal-table'
|
8
|
-
require '
|
8
|
+
require 'parseconfig'
|
9
|
+
require 'pathname'
|
9
10
|
|
10
11
|
actions_available = ["groups", "hosts", "clusters", "snapshots", "restorejobs", "restorejobs-create"]
|
11
12
|
|
@@ -15,18 +16,28 @@ app_usage = "#{app_name} command [options]"
|
|
15
16
|
app_version = MMS::VERSION
|
16
17
|
app_commands = "#{actions_available.join(' | ')}"
|
17
18
|
|
19
|
+
config = {}
|
18
20
|
options = {}
|
21
|
+
|
22
|
+
config_file = Pathname.new(Dir.home) + app_name.prepend('.')
|
23
|
+
if config_file.exist?
|
24
|
+
config = ParseConfig.new(config_file)
|
25
|
+
end
|
26
|
+
|
19
27
|
optparse = OptionParser.new do |opts|
|
20
28
|
opts.banner = "#{app_dscr}\n\nUsage:\n\n\t#{app_usage}\n\nCommands:\n\n\t#{app_commands}\n\nOptions:\n\n"
|
21
29
|
|
30
|
+
options[:username] = config['username']
|
22
31
|
opts.on("-u", "--username <string>", "MMS user") do |u|
|
23
32
|
options[:username] = u
|
24
33
|
end
|
25
34
|
|
35
|
+
options[:apikey] = config['apikey']
|
26
36
|
opts.on("-k", "--apikey <string>", "MMS api-key") do |k|
|
27
37
|
options[:apikey] = k
|
28
38
|
end
|
29
39
|
|
40
|
+
options[:apiurl] = config['apiurl']
|
30
41
|
opts.on("-a", "--apiurl <string>", "MMS api url. Full url including version: https://mms.mydomain.tld/api/public/v1.0") do |a|
|
31
42
|
options[:apiurl] = a
|
32
43
|
end
|
@@ -36,7 +47,7 @@ optparse = OptionParser.new do |opts|
|
|
36
47
|
options[:name] = n
|
37
48
|
end
|
38
49
|
|
39
|
-
options[:limit] = 5
|
50
|
+
options[:limit] = config['limit'] || 5
|
40
51
|
opts.on("-l", "--limit <int>", "Limit for result items") do |l|
|
41
52
|
options[:limit] = l.to_i
|
42
53
|
end
|
@@ -69,7 +80,7 @@ rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
|
69
80
|
end
|
70
81
|
|
71
82
|
begin
|
72
|
-
action = ARGV.first.downcase
|
83
|
+
action = (ARGV.first || config['action'] || '').downcase
|
73
84
|
raise("Unknown action #{action.upcase}") unless actions_available.include? (action)
|
74
85
|
rescue => e
|
75
86
|
puts "Error: #{e.message}"
|
data/lib/mms/cache.rb
CHANGED
data/lib/mms/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mms-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cargo Media
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-12-
|
13
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: net-http-digest_auth
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.4.5
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: parseconfig
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.0.6
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.0.6
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: rake
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|