dscli 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 659a1cd137fc6ed362875305de3707027c51bc5f
4
- data.tar.gz: 5d16b69ae18941506917be9d88593b2e65d3ce06
3
+ metadata.gz: bcb9011506fd048a9047144b94be5210103adf7a
4
+ data.tar.gz: 353e70a778602fb99364f06fc522f9f7bf8aae61
5
5
  SHA512:
6
- metadata.gz: ab99b542b44b8e6f62d827cfe5e92db0c0dabe422b1a15dd3c7addd10b8bf7da9b16ba0c078dd3ba20de8ca2f5a6c748169b89e58466abe9c4e92e4556dd3b16
7
- data.tar.gz: 2570c8b218b4599f0c7b074965cc67e4dae79a460429874d34d3ea10b9aa5e39f23f6dc86417189981d1d75191599eec223aab58392b1e69d90831b9a88b315c
6
+ metadata.gz: 036721549d4ecefa74ccf1f8c5aff2ec7cdae6f6139b32008b9d560dfc770abc63c2837b793f52ad71a8c069a917b93917140e223e2297830c308d81850a4902
7
+ data.tar.gz: de5e4d1d16c95e79f26805bab9a57b8abec6d2938674f253385f7cbf33da2cef743ee86ab967731d9ed2863b2d6fcfbb6ff23ecffcf856ea55bead5be053afd5
@@ -1,10 +1,10 @@
1
1
  dir = File.dirname(__FILE__)
2
- require dir + "/dscli/push"
3
- require dir + "/dscli/historics"
4
- require dir + "/dscli/source"
5
- require dir + "/dscli/core"
6
- require dir + "/dscli/cli"
7
- require dir + "/dscli/version"
8
- require dir + "/dscli/api"
9
- require dir + "/dscli/storage"
10
- require dir + "/dscli/parameters"
2
+ require dir + '/dscli/push'
3
+ require dir + '/dscli/historics'
4
+ require dir + '/dscli/source'
5
+ require dir + '/dscli/core'
6
+ require dir + '/dscli/cli'
7
+ require dir + '/dscli/version'
8
+ require dir + '/dscli/api'
9
+ require dir + '/dscli/storage'
10
+ require dir + '/dscli/parameters'
@@ -87,15 +87,22 @@ module Dscli
87
87
  end
88
88
 
89
89
  def push_log(id)
90
-
91
90
  if id.nil?
92
91
  response = @datasift.push.log
93
92
  else
94
93
  response = @datasift.push.log_for(id)
95
94
  end
96
-
97
95
  return response[:data]
96
+ end
98
97
 
98
+ def push_pause(id)
99
+ response = @datasift.push.pause(id)
100
+ return response
101
+ end
102
+
103
+ def push_resume(id)
104
+ response = @datasift.push.resume(id)
105
+ return response
99
106
  end
100
107
 
101
108
  #######################################################
@@ -119,6 +126,14 @@ module Dscli
119
126
  return @datasift.historics.delete(id)
120
127
  end
121
128
 
129
+ def historics_pause(id)
130
+ return @datasift.historics.pause(id)
131
+ end
132
+
133
+ def historics_resume(id)
134
+ return @datasift.historics.resume(id)
135
+ end
136
+
122
137
  #######################################################
123
138
  # MANAGED SOURCES
124
139
  #######################################################
@@ -148,7 +163,5 @@ module Dscli
148
163
  response = @datasift.managed_source.log(id,1,20)
149
164
  response[:data]
150
165
  end
151
-
152
166
  end
153
-
154
167
  end
@@ -1,68 +1,80 @@
1
1
  class Historics < Thor
2
-
3
- desc 'list [page]', 'Lists all historic queries'
2
+
3
+ desc 'list [page]', 'Lists all Historics queries'
4
4
  def list(page = 1)
5
5
  api = Dscli::API.new
6
6
  results = api.historics_list(page)
7
7
 
8
- puts "\nTotal Historic Queries: #{results.count}\n\n"
8
+ puts "\nTotal Historics Queries: #{results.count}\n\n"
9
9
  puts 'ID | Name | Created | Definition Hash | Status '
10
10
  puts '---------------------------------------------------------------------------------------------------------------------------'
11
11
 
12
12
  results[:data].each { |s| puts "#{s[:id]} | #{ '%-20.20s' % s[:name] } | #{Time.at(s[:created_at])} | #{ s[:definition_id] } | #{s[:status]}" }
13
13
  puts "\n"
14
-
15
14
  end
16
15
 
17
- desc 'get (id)', 'Gets details of a historic query'
16
+ desc 'get (id)', 'Gets details of an Historics query'
18
17
  def get(id)
19
-
20
- begin
21
- api = Dscli::API.new
22
- response = api.historics_get(id)
23
- puts response[:data].to_yaml
24
- rescue ApiResourceNotFoundError => e
25
- puts "Specified historic query '#{id}' was not found. It may have already been deleted."
26
- end
27
-
18
+ api = Dscli::API.new
19
+ response = api.historics_get(id)
20
+ puts response[:data].to_yaml
21
+ rescue ApiResourceNotFoundError => e
22
+ puts "Specified historic query '#{id}' was not found. It may have already been deleted."
28
23
  end
29
24
 
30
- desc 'stop (id)', 'Stops a historic query'
25
+ desc 'stop (id)', 'Stops an Historics query'
31
26
  def stop(id)
32
27
  api = Dscli::API.new
33
-
34
- begin
35
- response = api.historics_stop(id)
28
+ response = api.historics_stop(id)
36
29
 
37
- if response[:http][:status] == 204
38
- puts "Historic query '#{id}' stopped successfully"
39
- else
40
- # TODO: How do we handle a different code?
41
- response
42
- end
43
- rescue ApiResourceNotFoundError => e
44
- puts "Specified historic query '#{id}' not found. It may have been deleted."
30
+ if response[:http][:status] == 204
31
+ puts "Historic query '#{id}' stopped successfully"
32
+ else
33
+ response
45
34
  end
46
-
35
+ rescue ApiResourceNotFoundError => e
36
+ puts "Specified historic query '#{id}' not found. It may have been deleted."
47
37
  end
48
38
 
49
- desc 'delete (id)', 'Deletes a historic query'
39
+ desc 'delete (id)', 'Deletes an Historics query'
50
40
  def delete(id)
51
41
  api = Dscli::API.new
42
+ response = api.historics_delete(id)
52
43
 
53
- begin
44
+ if response[:http][:status] == 204
45
+ puts "Historic query '#{id}' deleted successfully"
46
+ else
47
+ response
48
+ end
49
+ rescue ApiResourceNotFoundError => e
50
+ puts "Specified historic query '#{id}' not found. It may have already been deleted."
51
+ end
54
52
 
55
- response = api.historics_delete(id)
53
+ desc 'pause (id)', 'Pauses an Historics query'
54
+ def pause(id)
55
+ api = Dscli::API.new
56
+ response = api.historics_pause(id)
56
57
 
57
- if response[:http][:status] == 204
58
- puts "Historic query '#{id}' deleted successfully"
59
- else
60
- response
61
- end
62
- rescue ApiResourceNotFoundError => e
63
- puts "Specified historic query '#{id}' not found. It may have already been deleted."
58
+ if response[:http][:status] == 204
59
+ puts "Historics query '#{id}' paused successfully"
60
+ else
61
+ response
64
62
  end
65
-
63
+ rescue ApiResourceNotFoundError => e
64
+ puts "Specified Historics query '#{id}' not found."
66
65
  end
67
66
 
68
- end
67
+ desc 'resume (id)', 'Resumes a paused Historics query'
68
+ def resume(id)
69
+ api = Dscli::API.new
70
+ response = api.historics_resume(id)
71
+
72
+ if response[:http][:status] == 204
73
+ puts "Historics query '#{id}' resumed successfully"
74
+ else
75
+ response
76
+ end
77
+ rescue ApiResourceNotFoundError => e
78
+ puts "Specified Historics query '#{id}' not found."
79
+ end
80
+ end
@@ -4,141 +4,141 @@ module Dscli
4
4
  class OutputParams
5
5
  include Interactive
6
6
 
7
- FORMATS = ["json_new_line", "json_meta", "json_array"]
8
- S3_ACL = ["private", "public-read", "public-read-write", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control"]
9
- HTTP_AUTH_TYPE = ["none", "basic"]
7
+ FORMATS = ['json_new_line', 'json_meta', 'json_array']
8
+ S3_ACL = ['private', 'public-read', 'public-read-write', 'authenticated-read', 'bucket-owner-read', 'bucket-owner-full-control']
9
+ HTTP_AUTH_TYPE = ['none', 'basic']
10
10
  DELIVERY_FREQUENCY = [0, 10, 30, 60, 300]
11
- MAX_SIZE = ["100KB", "250KB", "500KB", "1MB", "2MB", "5MB", "10MB", "20MB"]
12
- HTTP_METHOD = ["POST", "PUT"]
13
- BOOL = ["true", "false"]
11
+ MAX_SIZE = ['100KB', '250KB', '500KB', '1MB', '2MB', '5MB', '10MB', '20MB']
12
+ HTTP_METHOD = ['POST', 'PUT']
13
+ BOOL = ['true', 'false']
14
14
 
15
15
  def acl
16
- ask "ACL", choices: S3_ACL.each, indexed: true, default: S3_ACL.first
16
+ ask 'ACL', choices: S3_ACL.each, indexed: true, default: S3_ACL.first
17
17
  end
18
18
 
19
19
  def api_hostname
20
- ask "Splunk Storm REST API host"
20
+ ask 'Splunk Storm REST API host'
21
21
  end
22
22
 
23
23
  def auth_access_key
24
- ask "AWS access key"
24
+ ask 'AWS access key'
25
25
  end
26
26
 
27
27
  def auth_access_token
28
- ask "Splunk Storm REST access token"
28
+ ask 'Splunk Storm REST access token'
29
29
  end
30
30
 
31
31
  def auth_password
32
- ask "Authentication password"
32
+ ask 'Authentication password'
33
33
  end
34
34
 
35
35
  def auth_secret_key
36
- ask "AWS secret key"
36
+ ask 'AWS secret key'
37
37
  end
38
38
 
39
39
  def auth_username
40
- ask "Authentication username"
40
+ ask 'Authentication username'
41
41
  end
42
42
 
43
43
  def auth_type
44
- ask "Auth type", choices: HTTP_AUTH_TYPE.each, indexed: true, default: HTTP_AUTH_TYPE.first
44
+ ask 'Auth type', choices: HTTP_AUTH_TYPE.each, indexed: true, default: HTTP_AUTH_TYPE.first
45
45
  end
46
46
 
47
47
  def bucket
48
- ask "Bucket name"
48
+ ask 'Bucket name'
49
49
  end
50
50
 
51
51
  def collection_name
52
- ask "MongoDB Collection name"
52
+ ask 'MongoDB Collection name'
53
53
  end
54
54
 
55
55
  def database
56
- ask "Numeric ID of your existing Redis database"
56
+ ask 'Numeric ID of your existing Redis database'
57
57
  end
58
58
 
59
59
  def db_name
60
- ask "Database name"
60
+ ask 'Database name'
61
61
  end
62
62
 
63
63
  def delivery_frequency
64
- ask "Delivery frequency (seconds)", choices: DELIVERY_FREQUENCY.each, indexed: true, default: DELIVERY_FREQUENCY.first
64
+ ask 'Delivery frequency (seconds)', choices: DELIVERY_FREQUENCY.each, indexed: true, default: DELIVERY_FREQUENCY.first
65
65
  end
66
66
 
67
67
  def directory
68
- ask "Directory"
68
+ ask 'Directory'
69
69
  end
70
70
 
71
71
  def file_prefix
72
- ask "Optional filename prefix", default: "DataSift"
72
+ ask 'Optional filename prefix', default: 'DataSift'
73
73
  end
74
74
 
75
75
  def format
76
- ask "Output format", choices: FORMATS.each, indexed: true
76
+ ask 'Output format', choices: FORMATS.each, indexed: true
77
77
  end
78
78
 
79
79
  def host
80
- ask "The host to connect to"
80
+ ask 'The host to connect to'
81
81
  end
82
82
 
83
83
  def list
84
- ask "Name of a Redis list to stores interactions"
84
+ ask 'Name of a Redis list to stores interactions'
85
85
  end
86
86
 
87
87
  def max_size
88
- max_size = ask "Max delivery size", choices: MAX_SIZE.each, indexed: true, default: MAX_SIZE.last
88
+ max_size = ask 'Max delivery size', choices: MAX_SIZE.each, indexed: true, default: MAX_SIZE.last
89
89
  human_size_to_number(max_size)
90
90
  end
91
91
 
92
92
  def method
93
- ask "HTTP request type", choices: HTTP_METHOD.each, indexed: true, default: HTTP_METHOD.first
93
+ ask 'HTTP request type', choices: HTTP_METHOD.each, indexed: true, default: HTTP_METHOD.first
94
94
  end
95
95
 
96
96
  def port
97
- ask "Port on the remote machine"
97
+ ask 'Port on the remote machine'
98
98
  end
99
99
 
100
100
  def project_id
101
- ask "ID of your Splunk Storm REST project"
101
+ ask 'ID of your Splunk Storm REST project'
102
102
  end
103
103
 
104
104
  def region
105
- ask "AWS region the destination table is set up in"
105
+ ask 'AWS region the destination table is set up in'
106
106
  end
107
107
 
108
108
  def server_level_auth_password
109
- ask "Server-level authentication password"
109
+ ask 'Server-level authentication password'
110
110
  end
111
111
 
112
112
  def server_level_auth_username
113
- ask "Server-level authentication username"
113
+ ask 'Server-level authentication username'
114
114
  end
115
115
 
116
116
  def source
117
- ask "Label used to mark data delivered to Zoomdata"
117
+ ask 'Label used to mark data delivered to Zoomdata'
118
118
  end
119
119
 
120
120
  def table
121
- ask "Name of the table to use"
121
+ ask 'Name of the table to use'
122
122
  end
123
123
 
124
124
  def type
125
- ask "The type that you want to use for the index"
125
+ ask 'The type that you want to use for the index'
126
126
  end
127
127
 
128
128
  def url
129
- ask "The URL to post data to"
129
+ ask 'The URL to post data to'
130
130
  end
131
131
 
132
132
  def use_gzip
133
- ask "Use GZip?", choices: BOOL.each, indexed: true, default: BOOL.last
133
+ ask 'Use GZip?', choices: BOOL.each, indexed: true, default: BOOL.last
134
134
  end
135
135
 
136
136
  def use_ssl
137
- ask "Use SSL?", choices: BOOL.each, indexed: true, default: BOOL.last
137
+ ask 'Use SSL?', choices: BOOL.each, indexed: true, default: BOOL.last
138
138
  end
139
139
 
140
140
  def verify_ssl
141
- ask "Verify SSL certificate?", choices: BOOL.each, indexed: true, default: BOOL.last
141
+ ask 'Verify SSL certificate?', choices: BOOL.each, indexed: true, default: BOOL.last
142
142
  end
143
143
 
144
144
  ###############
@@ -149,8 +149,8 @@ module Dscli
149
149
 
150
150
  def human_size_to_number(size)
151
151
  value = size.scan(/[A-Z]+\d*|\d+/)
152
- bytes = value[0].to_i * 1024 if value[1] == "KB"
153
- bytes = value[0].to_i * 1024 * 1024 if value[1] == "MB"
152
+ bytes = value[0].to_i * 1024 if value[1] == 'KB'
153
+ bytes = value[0].to_i * 1024 * 1024 if value[1] == 'MB'
154
154
  return bytes.to_s
155
155
  end
156
156
 
@@ -5,16 +5,11 @@ module Dscli
5
5
  include Interactive
6
6
 
7
7
  def user_config(options)
8
-
9
8
  config = options.dup
9
+ username = ask 'DataSift Username'
10
+ api_key = ask 'DataSift API Key'
10
11
 
11
- username = ask "DataSift Username"
12
- api_key = ask "DataSift API Key"
13
-
14
- config = {:auth => {:username => username, :api_key => api_key}}
15
-
16
- return config
12
+ config = { auth: { username: username, api_key: api_key } }
17
13
  end
18
-
19
14
  end
20
- end
15
+ end
@@ -17,64 +17,81 @@ class Push < Thor
17
17
 
18
18
  desc 'get (id)', 'Gets details of a push subscription'
19
19
  def get(id)
20
- begin
21
- api = Dscli::API.new
22
- response = api.push_get(id)
23
- puts response[:data].to_yaml
24
- rescue ApiResourceNotFoundError => e
25
- puts "Specified push subscription '#{id}' not found. It may have already been deleted."
26
- end
20
+ api = Dscli::API.new
21
+ response = api.push_get(id)
22
+ puts response[:data].to_yaml
23
+ rescue ApiResourceNotFoundError
24
+ puts "Specified push subscription '#{id}' not found. It may have been deleted."
27
25
  end
28
26
 
29
27
  desc 'stop (id)', 'Stops a push subscription'
30
28
  def stop(id)
31
- begin
32
- api = Dscli::API.new
33
- api.push_stop(id)
34
- rescue ApiResourceNotFoundError => e
35
- puts "Specified push subscription '#{id}' not found. It may have been deleted."
36
- rescue BadRequestError => e
37
- puts "Specified push subscription '#{id}' could not be stopped. It may have already been stopped."
38
- end
29
+ api = Dscli::API.new
30
+ api.push_stop(id)
31
+ rescue ApiResourceNotFoundError
32
+ puts "Specified push subscription '#{id}' not found. It may have been deleted."
33
+ rescue BadRequestError
34
+ puts "Specified push subscription '#{id}' could not be stopped. It may have already been stopped."
39
35
  end
40
36
 
41
37
  desc 'delete (id)', 'Deletes a push subscription'
42
38
  def delete(id)
43
39
  api = Dscli::API.new
40
+ response = api.push_delete(id)
44
41
 
45
- begin
46
- response = api.push_delete(id)
47
-
48
- if response[:http][:status] == 204
49
- puts "Push subscription #{id} deleted successfully"
50
- else
51
- # TODO: How do we handle a different code?
52
- response
53
- end
54
- rescue ApiResourceNotFoundError => e
55
- puts "Specified push subscription '#{id}' not found. It may have already been deleted."
42
+ if response[:http][:status] == 204
43
+ puts "Push subscription #{id} deleted successfully"
44
+ else
45
+ # TODO: How do we handle a different code?
46
+ response
56
47
  end
48
+ rescue ApiResourceNotFoundError
49
+ puts "Specified push subscription '#{id}' not found. It may have already been deleted."
57
50
  end
58
51
 
59
52
  desc 'log [id]', 'Retrieves logs for all subscriptions (or for the subscription ID supplied)'
60
53
  def log(id = nil)
61
54
  api = Dscli::API.new
55
+ results = api.push_log(id)
56
+
57
+ puts "\nMessage count: #{results[:count]}\n\n"
62
58
 
63
- begin
64
- results = api.push_log(id)
59
+ if results[:count] > 0
60
+ puts ' Time | Subscription ID | Message '
61
+ puts '-----------------------------------------------------------------------------------------------------------------'
65
62
 
66
- puts "\nMessage count: #{results[:count]}\n\n"
63
+ results[:log_entries].each { |s| puts "#{Time.at(s[:request_time]) } | #{s[:subscription_id]} | #{ '%-50.50s' % s[:message] }" }
64
+ puts "\n"
65
+ end
66
+ rescue ApiResourceNotFoundError
67
+ puts "Specified push subscription '#{id}' not found. It may have been deleted."
68
+ end
67
69
 
68
- if results[:count] > 0
69
- puts ' Time | Subscription ID | Message '
70
- puts '-----------------------------------------------------------------------------------------------------------------'
70
+ desc 'pause (id)', 'Pauses a push subscription'
71
+ def pause(id)
72
+ api = Dscli::API.new
73
+ response = api.push_pause(id)
71
74
 
72
- results[:log_entries].each { |s| puts "#{Time.at(s[:request_time]) } | #{s[:subscription_id]} | #{ '%-50.50s' % s[:message] }" }
73
- puts "\n"
74
- end
75
- rescue ApiResourceNotFoundError => e
76
- puts "Specified push subscription '#{id}' not found. It may have been deleted."
75
+ if response[:http][:status] == 204
76
+ puts "Push subscription #{id} paused successfully"
77
+ else
78
+ response
77
79
  end
80
+ rescue ApiResourceNotFoundError
81
+ puts "Specified push subscription '#{id}' not found."
78
82
  end
79
83
 
80
- end
84
+ desc 'resume (id)', 'Resumes a paused push subscription'
85
+ def resume(id)
86
+ api = Dscli::API.new
87
+ response = api.push_resume(id)
88
+
89
+ if response[:http][:status] == 204
90
+ puts "Push subscription #{id} resumed successfully"
91
+ else
92
+ response
93
+ end
94
+ rescue ApiResourceNotFoundError
95
+ puts "Specified push subscription '#{id}' not found."
96
+ end
97
+ end
@@ -1,6 +1,6 @@
1
1
  class Source < Thor
2
2
 
3
- desc 'list [page]', 'Lists all managed sources'
3
+ desc 'list [page]', 'Lists all Managed Sources'
4
4
  def list(page = 1)
5
5
  api = Dscli::API.new
6
6
  results = api.source_list(page)
@@ -11,100 +11,74 @@ class Source < Thor
11
11
 
12
12
  results[:sources].each { |s| puts "#{s[:id]} | #{ '%-20.20s' % s[:name] } | #{ '%-20.20s' % s[:source_type] } | #{s[:status]}" }
13
13
  puts "\n"
14
-
15
14
  end
16
15
 
17
16
  desc 'get (id)', 'Gets details of a managed source'
18
17
  def get(id)
19
-
20
- begin
21
- api = Dscli::API.new
22
- response = api.source_get(id)
23
- puts response[:data].to_yaml
24
- rescue ApiResourceNotFoundError => e
25
- puts "Specified managed source '#{id}' was not found. It may have been deleted."
26
- end
27
-
18
+ api = Dscli::API.new
19
+ response = api.source_get(id)
20
+ puts response[:data].to_yaml
21
+ rescue ApiResourceNotFoundError
22
+ puts "Specified managed source '#{id}' was not found. It may have been deleted."
28
23
  end
29
24
 
30
25
  desc 'start (id)', 'Starts the specified source'
31
26
  def start(id)
32
-
33
27
  api = Dscli::API.new
34
-
35
- begin
36
- response = api.source_start(id)
28
+ response = api.source_start(id)
37
29
 
38
- if response[:http][:status] == 200
39
- puts "Managed source '#{id}' started successfully"
40
- else
41
- # TODO: How do we handle a different code?
42
- response
43
- end
44
- rescue ApiResourceNotFoundError => e
45
- puts "Specified source '#{id}' not found. It may have been deleted."
30
+ if response[:http][:status] == 200
31
+ puts "Managed source '#{id}' started successfully"
32
+ else
33
+ # TODO: How do we handle a different code?
34
+ response
46
35
  end
47
-
36
+ rescue ApiResourceNotFoundError
37
+ puts "Specified source '#{id}' not found. It may have been deleted."
48
38
  end
49
39
 
50
40
  desc 'stop (id)', 'Stops the specified source'
51
41
  def stop(id)
52
-
53
42
  api = Dscli::API.new
54
-
55
- begin
56
- response = api.source_stop(id)
43
+ response = api.source_stop(id)
57
44
 
58
- if response[:http][:status] == 200
59
- puts "Managed source '#{id}' stopped successfully"
60
- else
61
- # TODO: How do we handle a different code?
62
- response
63
- end
64
- rescue ApiResourceNotFoundError => e
65
- puts "Specified source '#{id}' not found. It may have been deleted."
45
+ if response[:http][:status] == 200
46
+ puts "Managed source '#{id}' stopped successfully"
47
+ else
48
+ # TODO: How do we handle a different code?
49
+ response
66
50
  end
67
-
51
+ rescue ApiResourceNotFoundError
52
+ puts "Specified source '#{id}' not found. It may have been deleted."
68
53
  end
69
54
 
70
55
  desc 'delete (id)', 'Deletes a managed source'
71
56
  def delete(id)
72
57
  api = Dscli::API.new
58
+ response = api.source_delete(id)
73
59
 
74
- begin
75
-
76
- response = api.source_delete(id)
77
-
78
- if response[:http][:status] == 204
79
- puts "Source '#{id}' deleted successfully"
80
- else
81
- response
82
- end
83
- rescue ApiResourceNotFoundError => e
84
- puts "Source '#{id}' not found. It may have been deleted."
60
+ if response[:http][:status] == 204
61
+ puts "Source '#{id}' deleted successfully"
62
+ else
63
+ response
85
64
  end
86
-
65
+ rescue ApiResourceNotFoundError
66
+ puts "Source '#{id}' not found. It may have been deleted."
87
67
  end
88
68
 
89
69
  desc 'logs (id)', 'Retrieves the log for a managed source'
90
70
  def logs(id = nil)
91
71
  api = Dscli::API.new
72
+ results = api.source_log(id)
92
73
 
93
- begin
74
+ puts "\nMessage count: #{results[:count]}\n\n"
75
+ puts ' Time | Message '
76
+ puts '-----------------------------------------------------------------------------------------------------------------'
94
77
 
95
- results = api.source_log(id)
78
+ results[:log_entries].each { |s| puts "#{Time.at(s[:event_time]) } | #{ '%-50.50s' % s[:message] }" }
79
+ puts "\n"
96
80
 
97
- puts "\nMessage count: #{results[:count]}\n\n"
98
- puts ' Time | Message '
99
- puts '-----------------------------------------------------------------------------------------------------------------'
100
-
101
- results[:log_entries].each { |s| puts "#{Time.at(s[:event_time]) } | #{ '%-50.50s' % s[:message] }" }
102
- puts "\n"
103
-
104
- rescue ApiResourceNotFoundError => e
105
- puts "Specified source '#{id}' not found. It may have been deleted."
106
- end
107
-
81
+ rescue ApiResourceNotFoundError
82
+ puts "Specified source '#{id}' not found. It may have been deleted."
108
83
  end
109
-
110
- end
84
+ end
@@ -1,3 +1,3 @@
1
1
  module Dscli
2
- VERSION = "0.1.3"
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dscli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Dugdale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -68,34 +68,20 @@ dependencies:
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: datasift
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
- - !ruby/object:Gem::Dependency
84
- name: interact
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: '0'
75
+ version: 3.0.1
90
76
  type: :runtime
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: '0'
82
+ version: 3.0.1
97
83
  - !ruby/object:Gem::Dependency
98
- name: multi_json
84
+ name: interact
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
@@ -152,8 +138,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
138
  version: '0'
153
139
  requirements: []
154
140
  rubyforge_project:
155
- rubygems_version: 2.4.1
141
+ rubygems_version: 2.4.8
156
142
  signing_key:
157
143
  specification_version: 4
158
144
  summary: Simple CLI wrapper for the DataSift Ruby client library
159
145
  test_files: []
146
+ has_rdoc: