qtc-sdk 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +18 -18
  3. data/Changelog.md +14 -6
  4. data/Gemfile +4 -4
  5. data/LICENSE.txt +22 -22
  6. data/README.md +44 -44
  7. data/Rakefile +1 -1
  8. data/bin/qtc-cli +13 -13
  9. data/lib/qtc/cli/commands.rb +15 -15
  10. data/lib/qtc/cli/common.rb +146 -91
  11. data/lib/qtc/cli/eds/base.rb +27 -27
  12. data/lib/qtc/cli/eds/commands.rb +20 -20
  13. data/lib/qtc/cli/eds/instances.rb +30 -30
  14. data/lib/qtc/cli/mar/apps.rb +116 -125
  15. data/lib/qtc/cli/mar/base.rb +60 -60
  16. data/lib/qtc/cli/mar/commands.rb +221 -199
  17. data/lib/qtc/cli/mar/debug.rb +87 -86
  18. data/lib/qtc/cli/mar/domains.rb +35 -38
  19. data/lib/qtc/cli/mar/env.rb +38 -40
  20. data/lib/qtc/cli/mar/repository.rb +24 -26
  21. data/lib/qtc/cli/mar/ssl_certificates.rb +40 -42
  22. data/lib/qtc/cli/mar/stack.rb +29 -0
  23. data/lib/qtc/cli/mdb/base.rb +47 -43
  24. data/lib/qtc/cli/mdb/commands.rb +43 -31
  25. data/lib/qtc/cli/mdb/instances.rb +79 -60
  26. data/lib/qtc/cli/platform/clouds.rb +33 -15
  27. data/lib/qtc/cli/platform/commands.rb +132 -65
  28. data/lib/qtc/cli/platform/datacenters.rb +23 -21
  29. data/lib/qtc/cli/platform/ssh_keys.rb +41 -41
  30. data/lib/qtc/cli/platform/user.rb +25 -25
  31. data/lib/qtc/cli/platform/vpn.rb +93 -0
  32. data/lib/qtc/client.rb +170 -170
  33. data/lib/qtc/eds/client.rb +116 -116
  34. data/lib/qtc/eds/collection.rb +124 -124
  35. data/lib/qtc/eds/user_collection.rb +13 -13
  36. data/lib/qtc/eds/usergroup_collection.rb +41 -41
  37. data/lib/qtc/errors.rb +13 -11
  38. data/lib/qtc/version.rb +3 -3
  39. data/lib/qtc-sdk.rb +1 -1
  40. data/qtc-sdk.gemspec +28 -28
  41. data/spec/unit/qtc/client_spec.rb +147 -147
  42. metadata +20 -19
  43. data/lib/qtc/mws/client.rb +0 -89
@@ -1,38 +1,35 @@
1
- require_relative 'base'
2
-
3
- module Qtc
4
- module Cli
5
- class Mar::Domains < Mar::Base
6
-
7
- def list(options)
8
- instance_id = resolve_instance_id(options)
9
- instance_data = instance_info(instance_id)
10
- if instance_data
11
- token = instance_data['authorizations'][0]['access_token']
12
- result = client.get("/apps/#{instance_id}/domains", nil, {'Authorization' => "Bearer #{token}"})
13
- result['results'].each do |r|
14
- print color("* #{r['name']}", :bold)
15
- end
16
- end
17
- end
18
-
19
- def create(name, options)
20
- instance_id = resolve_instance_id(options)
21
- instance_data = instance_info(instance_id)
22
- if instance_data
23
- token = instance_data['authorizations'][0]['access_token']
24
- client.post("/apps/#{instance_id}/domains", {name: name}, {}, {'Authorization' => "Bearer #{token}"})
25
- end
26
- end
27
-
28
- def destroy(name, options)
29
- instance_id = resolve_instance_id(options)
30
- instance_data = instance_info(instance_id)
31
- if instance_data
32
- token = instance_data['authorizations'][0]['access_token']
33
- client.delete("/apps/#{instance_id}/domains/#{name}", nil, {}, {'Authorization' => "Bearer #{token}"})
34
- end
35
- end
36
- end
37
- end
38
- end
1
+ require_relative 'base'
2
+
3
+ module Qtc
4
+ module Cli
5
+ class Mar::Domains < Mar::Base
6
+
7
+ def list(options)
8
+ instance_id = resolve_instance_id(options)
9
+ instance_data = instance_info(instance_id)
10
+ if instance_data
11
+ result = client.get("/apps/#{instance_id}/domains", nil, {'Authorization' => "Bearer #{current_cloud_token}"})
12
+ result['results'].each do |r|
13
+ print color("* #{r['name']}", :bold)
14
+ end
15
+ end
16
+ end
17
+
18
+ def create(name, options)
19
+ instance_id = resolve_instance_id(options)
20
+ instance_data = instance_info(instance_id)
21
+ if instance_data
22
+ client.post("/apps/#{instance_id}/domains", {name: name}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
23
+ end
24
+ end
25
+
26
+ def destroy(name, options)
27
+ instance_id = resolve_instance_id(options)
28
+ instance_data = instance_info(instance_id)
29
+ if instance_data
30
+ client.delete("/apps/#{instance_id}/domains/#{name}", nil, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,40 +1,38 @@
1
- require_relative 'base'
2
-
3
- module Qtc
4
- module Cli
5
- class Mar::Env < Mar::Base
6
-
7
- def set(vars, options)
8
- instance_id = resolve_instance_id(options)
9
- env_vars = {}
10
- vars.each do |type|
11
- arr = type.strip.split('=', 2)
12
- if arr[0]
13
- if arr[1].nil? || arr[1] == ''
14
- env_vars[arr[0]] = nil
15
- else
16
- env_vars[arr[0]] = arr[1]
17
- end
18
- end
19
- end
20
- instance_data = instance_info(instance_id)
21
- if instance_data
22
- token = instance_data['authorizations'][0]['access_token']
23
- client.put("/apps/#{instance_id}/env_vars", env_vars, {}, {'Authorization' => "Bearer #{token}"})
24
- end
25
- end
26
-
27
- def show(options)
28
- instance_id = resolve_instance_id(options)
29
- instance_data = instance_info(instance_id)
30
- if instance_data
31
- token = instance_data['authorizations'][0]['access_token']
32
- env_vars = client.get("/apps/#{instance_id}/env_vars", {}, {'Authorization' => "Bearer #{token}"})
33
- env_vars.each do |key, value|
34
- puts "#{key}=#{value}"
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
1
+ require_relative 'base'
2
+
3
+ module Qtc
4
+ module Cli
5
+ class Mar::Env < Mar::Base
6
+
7
+ def set(vars, options)
8
+ instance_id = resolve_instance_id(options)
9
+ env_vars = {}
10
+ vars.each do |type|
11
+ arr = type.strip.split('=', 2)
12
+ if arr[0]
13
+ if arr[1].nil? || arr[1] == ''
14
+ env_vars[arr[0]] = nil
15
+ else
16
+ env_vars[arr[0]] = arr[1]
17
+ end
18
+ end
19
+ end
20
+ instance_data = instance_info(instance_id)
21
+ if instance_data
22
+ client.put("/apps/#{instance_id}/env_vars", env_vars, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
23
+ end
24
+ end
25
+
26
+ def show(options)
27
+ instance_id = resolve_instance_id(options)
28
+ instance_data = instance_info(instance_id)
29
+ if instance_data
30
+ env_vars = client.get("/apps/#{instance_id}/env_vars", {}, {'Authorization' => "Bearer #{current_cloud_token}"})
31
+ env_vars.each do |key, value|
32
+ puts "#{key}=#{value}"
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,26 +1,24 @@
1
- require_relative 'base'
2
-
3
- module Qtc
4
- module Cli
5
- class Mar::Repository < Mar::Base
6
-
7
- def purge_cache(options)
8
- instance_id = resolve_instance_id(options)
9
- instance_data = instance_info(instance_id)
10
- if instance_data
11
- token = instance_data['authorizations'][0]['access_token']
12
- client.delete("/apps/#{instance_id}/build_cache", nil, {}, {'Authorization' => "Bearer #{token}"})
13
- end
14
- end
15
-
16
- def reset(options)
17
- instance_id = resolve_instance_id(options)
18
- instance_data = instance_info(instance_id)
19
- if instance_data
20
- token = instance_data['authorizations'][0]['access_token']
21
- client.delete("/apps/#{instance_id}/repository", nil, {}, {'Authorization' => "Bearer #{token}"})
22
- end
23
- end
24
- end
25
- end
26
- end
1
+ require_relative 'base'
2
+
3
+ module Qtc
4
+ module Cli
5
+ class Mar::Repository < Mar::Base
6
+
7
+ def purge_cache(options)
8
+ instance_id = resolve_instance_id(options)
9
+ instance_data = instance_info(instance_id)
10
+ if instance_data
11
+ client.delete("/apps/#{instance_id}/build_cache", nil, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
12
+ end
13
+ end
14
+
15
+ def reset(options)
16
+ instance_id = resolve_instance_id(options)
17
+ instance_data = instance_info(instance_id)
18
+ if instance_data
19
+ client.delete("/apps/#{instance_id}/repository", nil, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,42 +1,40 @@
1
- require 'base64'
2
- require_relative 'base'
3
-
4
- module Qtc
5
- module Cli
6
- class Mar::SslCertificates < Mar::Base
7
-
8
-
9
- def create(options)
10
- raise ArgumentError.new("--key=#{options.key} is not a file") unless File.exists?(File.expand_path(options.key))
11
- raise ArgumentError.new("--cert=#{options.cert} is not a file") unless File.exists?(File.expand_path(options.cert))
12
- unless options.chain.nil?
13
- raise ArgumentError.new("--chain=#{options.chain} is not a file") unless File.exists?(File.expand_path(options.chain))
14
- end
15
-
16
- instance_id = resolve_instance_id(options)
17
- instance_data = instance_info(instance_id)
18
- if instance_data
19
- token = instance_data['authorizations'][0]['access_token']
20
- data = {
21
- name: instance_id,
22
- privateKey: File.read(File.expand_path(options.key)),
23
- certificateBody: File.read(File.expand_path(options.cert))
24
- }
25
- unless options.chain.nil?
26
- data[:certificateChain] = File.read(File.expand_path(options.chain))
27
- end
28
- client.post("/apps/#{instance_id}/ssl_certificate", data, {}, {'Authorization' => "Bearer #{token}"})
29
- end
30
- end
31
-
32
- def destroy(options)
33
- instance_id = resolve_instance_id(options)
34
- instance_data = instance_info(instance_id)
35
- if instance_data
36
- token = instance_data['authorizations'][0]['access_token']
37
- client.delete("/apps/#{instance_id}/ssl_certificate", {}, {}, {'Authorization' => "Bearer #{token}"})
38
- end
39
- end
40
- end
41
- end
42
- end
1
+ require 'base64'
2
+ require_relative 'base'
3
+
4
+ module Qtc
5
+ module Cli
6
+ class Mar::SslCertificates < Mar::Base
7
+
8
+
9
+ def create(options)
10
+ raise ArgumentError.new("--key=#{options.key} is not a file") unless File.exists?(File.expand_path(options.key))
11
+ raise ArgumentError.new("--cert=#{options.cert} is not a file") unless File.exists?(File.expand_path(options.cert))
12
+ unless options.chain.nil?
13
+ raise ArgumentError.new("--chain=#{options.chain} is not a file") unless File.exists?(File.expand_path(options.chain))
14
+ end
15
+
16
+ instance_id = resolve_instance_id(options)
17
+ instance_data = instance_info(instance_id)
18
+ if instance_data
19
+ data = {
20
+ name: instance_id,
21
+ privateKey: File.read(File.expand_path(options.key)),
22
+ certificateBody: File.read(File.expand_path(options.cert))
23
+ }
24
+ unless options.chain.nil?
25
+ data[:certificateChain] = File.read(File.expand_path(options.chain))
26
+ end
27
+ client.post("/apps/#{instance_id}/ssl_certificate", data, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
28
+ end
29
+ end
30
+
31
+ def destroy(options)
32
+ instance_id = resolve_instance_id(options)
33
+ instance_data = instance_info(instance_id)
34
+ if instance_data
35
+ client.delete("/apps/#{instance_id}/ssl_certificate", {}, {}, {'Authorization' => "Bearer #{current_cloud_token}"})
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'base'
2
+
3
+ module Qtc
4
+ module Cli
5
+ class Mar::Stack < Mar::Base
6
+
7
+ def update(name, options)
8
+ instance_id = resolve_instance_id(options)
9
+ instance_data = instance_info(instance_id)
10
+ if instance_data
11
+ client.put("/apps/#{instance_id}", {stack: name}, nil, {'Authorization' => "Bearer #{current_cloud_token}"})
12
+ puts "Stack is now set to: #{name}"
13
+ puts "Next release on #{instance_data['name']} will use #{name} stack."
14
+ puts "Use `git push <remote> master` to create new release on #{name}"
15
+ end
16
+ end
17
+
18
+ def show(options)
19
+ instance_id = resolve_instance_id(options)
20
+ instance_data = instance_info(instance_id)
21
+ if instance_data
22
+ env_vars = client.get("/apps/#{instance_id}/env_vars", {}, {'Authorization' => "Bearer #{current_cloud_token}"})
23
+ puts "App is using stack: #{env_vars['STACK']}"
24
+ puts ""
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,43 +1,47 @@
1
- require_relative '../../client'
2
- require_relative '../common'
3
-
4
- module Qtc
5
- module Cli
6
- module Mdb
7
- class Base
8
- include Cli::Common
9
-
10
- protected
11
-
12
- ##
13
- # @param [String] instance_id
14
- # @return [String,NilClass]
15
- def resolve_datacenter_id(instance_id)
16
- match = instance_id.to_s.match(/^(mdb-\w+-\w+)-\w+/)
17
- if match[1]
18
- match[1]
19
- end
20
- end
21
-
22
- ##
23
- # @return [Qtc::Client]
24
- def client
25
- if @client.nil?
26
- @client = Qtc::Client.new(base_url)
27
- end
28
-
29
- @client
30
- end
31
-
32
- def base_url
33
- datacenters = inifile['datacenters'] || {}
34
- if !self.datacenter_id.nil? && datacenters.has_key?(self.datacenter_id)
35
- "#{datacenters[self.datacenter_id]}/v1"
36
- else
37
- raise ArgumentError.new('Unknown datacenter. Please run qtc-cli datacenters to get latest list of your datacenters')
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
1
+ require_relative '../../client'
2
+ require_relative '../common'
3
+
4
+ module Qtc
5
+ module Cli
6
+ module Mdb
7
+ class Base
8
+ include Cli::Common
9
+
10
+ protected
11
+
12
+ ##
13
+ # @param [String] instance_id
14
+ # @return [String,NilClass]
15
+ def resolve_datacenter_id(instance_id)
16
+ match = instance_id.to_s.match(/^(mdb-\w+-\w+)-\w+/)
17
+ if match[1]
18
+ match[1]
19
+ end
20
+ end
21
+
22
+ def mdb_datacenter_id
23
+ "mdb-#{current_cloud_dc}"
24
+ end
25
+
26
+ ##
27
+ # @return [Qtc::Client]
28
+ def client
29
+ if @client.nil?
30
+ @client = Qtc::Client.new(base_url)
31
+ end
32
+
33
+ @client
34
+ end
35
+
36
+ def base_url
37
+ datacenters = inifile['datacenters'] || {}
38
+ if !self.datacenter_id.nil? && datacenters.has_key?(self.datacenter_id)
39
+ "#{datacenters[self.datacenter_id]}/v1"
40
+ else
41
+ raise ArgumentError.new('Unknown datacenter. Please run qtc-cli datacenters to get latest list of your datacenters')
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,31 +1,43 @@
1
- require_relative 'instances'
2
-
3
- command 'mdb list' do |c|
4
- c.syntax = 'qtc-cli mdb list'
5
- c.description = 'List all MDB instances'
6
- c.action do |args, options|
7
- Qtc::Cli::Mdb::Instances.new.list
8
- end
9
- end
10
-
11
- command 'mdb show' do |c|
12
- c.syntax = 'qtc-cli mdb show'
13
- c.description = 'Show MDB instance info'
14
- c.option '--id ID', String, 'MDB instance id'
15
- c.action do |args, options|
16
- Qtc::Cli::Mdb::Instances.new.show(options)
17
- end
18
- end
19
-
20
- command 'mdb logs' do |c|
21
- c.syntax = 'qtc-cli mdb logs'
22
- c.description = 'Show MDB logs'
23
- c.option '--id ID', String, 'MDB instance id'
24
- c.option '--timestamp', String, 'Include timestamp'
25
- c.option '--stream', String, 'stdout or stderr'
26
- c.option '--limit LIMIT', Integer, 'Limit'
27
- c.option '--offset OFFSET', Integer, 'Offset'
28
- c.action do |args, options|
29
- Qtc::Cli::Mdb::Instances.new.logs(options)
30
- end
31
- end
1
+ require_relative 'instances'
2
+
3
+ command 'mdb list' do |c|
4
+ c.syntax = 'qtc-cli mdb list'
5
+ c.description = 'List all MDB instances'
6
+ c.action do |args, options|
7
+ Qtc::Cli::Mdb::Instances.new.list
8
+ end
9
+ end
10
+
11
+ command 'mdb show' do |c|
12
+ c.syntax = 'qtc-cli mdb show'
13
+ c.description = 'Show MDB instance info'
14
+ c.option '--id ID', String, 'MDB instance id'
15
+ c.action do |args, options|
16
+ Qtc::Cli::Mdb::Instances.new.show(options)
17
+ end
18
+ end
19
+
20
+ command 'mdb create' do |c|
21
+ c.syntax = 'qtc-cli mdb create NAME'
22
+ c.description = 'Create a new MDB instance'
23
+ c.option '--type TYPE', String, 'MDB type'
24
+ c.option '--size SIZE', String, 'MDB size'
25
+ c.action do |args, options|
26
+ raise ArgumentError.new('NAME is required') if args[0].nil?
27
+ raise ArgumentError.new('--type is required (example: mysql:5.6)') if options.type.nil?
28
+ Qtc::Cli::Mdb::Instances.new.create(args[0], options)
29
+ end
30
+ end
31
+
32
+ command 'mdb logs' do |c|
33
+ c.syntax = 'qtc-cli mdb logs'
34
+ c.description = 'Show MDB logs'
35
+ c.option '--id ID', String, 'MDB instance id'
36
+ c.option '--timestamp', String, 'Include timestamp'
37
+ c.option '--stream', String, 'stdout or stderr'
38
+ c.option '--limit LIMIT', Integer, 'Limit'
39
+ c.option '--offset OFFSET', Integer, 'Offset'
40
+ c.action do |args, options|
41
+ Qtc::Cli::Mdb::Instances.new.logs(options)
42
+ end
43
+ end
@@ -1,60 +1,79 @@
1
- require_relative 'base'
2
-
3
- module Qtc
4
- module Cli
5
- class Mdb::Instances < Mdb::Base
6
- include Qtc::Cli::Common
7
-
8
- def list
9
- accounts = platform_client.get('/user/accounts')
10
- accounts['results'].each do |account|
11
- print color("== #{account['name']}: #{account['id']}")
12
- instances = platform_client.get("/accounts/#{account['id']}/instances", {provider: 'mdb'})
13
- instances['results'].each do |instance|
14
- say(" ~ <%= color('#{instance['id']}', :green) %> #{instance['name']} <%= color('#{instance['tags'].join(', ')}', :yellow) %>")
15
- end
16
- puts ''
17
- end
18
- end
19
-
20
- def show(options)
21
- raise ArgumentError.new('--id is required') if options.id.nil?
22
-
23
- self.datacenter_id = self.resolve_datacenter_id(options.id)
24
- instance_id = options.id
25
- instance_data = instance_info(instance_id)
26
- if instance_data
27
- token = instance_data['authorizations'][0]['access_token']
28
- result = client.get("/services/#{instance_id}", nil, {'Authorization' => "Bearer #{token}"})
29
- puts "Id: #{result['id']}"
30
- puts "Name: #{result['name']}"
31
- puts "Type: #{result['image']['name']}"
32
- puts "Size: #{result['size'].to_i * 256}MB"
33
- puts "State: #{result['state']}"
34
- end
35
- end
36
-
37
- def logs(options)
38
- raise ArgumentError.new('--id is required') if options.id.nil?
39
-
40
- self.datacenter_id = self.resolve_datacenter_id(options.id)
41
- offset = options.offset || 0
42
- limit = options.limit || 100
43
- stream = options.stream || nil
44
-
45
- instance_id = options.id
46
- instance_data = instance_info(instance_id)
47
- if instance_data
48
- token = instance_data['authorizations'][0]['access_token']
49
- result = client.get("/services/#{instance_id}/logs", {offset: offset, limit: limit}, {'Authorization' => "Bearer #{token}"})
50
- result['results'].each do |r|
51
- line = ''
52
- line << "[#{r['time']}] " if options.timestamp == true
53
- line << r['log']
54
- puts line
55
- end
56
- end
57
- end
58
- end
59
- end
60
- end
1
+ require_relative 'base'
2
+
3
+ module Qtc
4
+ module Cli
5
+ class Mdb::Instances < Mdb::Base
6
+ include Qtc::Cli::Common
7
+
8
+ def list
9
+ instances = platform_client(current_cloud_token).get("/accounts/#{current_cloud_id}/instances", {provider: 'mdb'})
10
+ template = "%-20.20s %-30.30s %-20.20s"
11
+ puts template % ["ID", "NAME", "TAGS"]
12
+ instances['results'].each do |instance|
13
+ puts template % [instance['id'], instance['name'], instance['tags'].join(',')]
14
+ end
15
+ end
16
+
17
+ def show(options)
18
+ raise ArgumentError.new('--id is required') if options.id.nil?
19
+
20
+ self.datacenter_id = self.resolve_datacenter_id(options.id)
21
+ instance_id = options.id
22
+ instance_data = instance_info(instance_id)
23
+ if instance_data
24
+ result = client.get("/services/#{instance_id}", nil, {'Authorization' => "Bearer #{current_cloud_token}"})
25
+ puts "Id: #{result['id']}"
26
+ puts "Name: #{result['name']}"
27
+ puts "Type: #{result['image']['name']}"
28
+ puts "Size: #{result['size'].to_i * 256}MB"
29
+ puts "State: #{result['state']}"
30
+ puts "Ip address: #{result['ip_address']}"
31
+ puts "Port: #{result['port']}"
32
+ if result['username']
33
+ puts "Username: #{result['username']}"
34
+ end
35
+ if result['password']
36
+ puts "Password: #{result['password']}"
37
+ end
38
+ end
39
+ end
40
+
41
+ def create(name, options)
42
+ sizes = {'256m' => 1, '512m' => 2, '768m' => 3, '1024m' => 4}
43
+ size = sizes[options.size.to_s.to_sym] || 1
44
+ data = {
45
+ name: name,
46
+ serviceProviderId: 'mdb',
47
+ config: {
48
+ runtimeSize: size,
49
+ serviceImage: "qtcs/#{options.type}"
50
+ }
51
+ }
52
+ response = platform_client.post("/accounts/#{current_cloud_id}/instances", data)
53
+ puts response['id']
54
+ end
55
+
56
+ def logs(options)
57
+ raise ArgumentError.new('--id is required') if options.id.nil?
58
+
59
+ self.datacenter_id = self.resolve_datacenter_id(options.id)
60
+ offset = options.offset || 0
61
+ limit = options.limit || 100
62
+ stream = options.stream || nil
63
+
64
+ instance_id = options.id
65
+ instance_data = instance_info(instance_id)
66
+ if instance_data
67
+ result = client.get("/services/#{instance_id}/logs", {offset: offset, limit: limit}, {'Authorization' => "Bearer #{current_cloud_token}"})
68
+ result['results'].each do |r|
69
+ line = ''
70
+ line << "[#{r['time']}] " if options.timestamp == true
71
+ line << r['log']
72
+ puts line
73
+ end
74
+ end
75
+ end
76
+
77
+ end
78
+ end
79
+ end