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.
- checksums.yaml +4 -4
- data/.gitignore +18 -18
- data/Changelog.md +14 -6
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +44 -44
- data/Rakefile +1 -1
- data/bin/qtc-cli +13 -13
- data/lib/qtc/cli/commands.rb +15 -15
- data/lib/qtc/cli/common.rb +146 -91
- data/lib/qtc/cli/eds/base.rb +27 -27
- data/lib/qtc/cli/eds/commands.rb +20 -20
- data/lib/qtc/cli/eds/instances.rb +30 -30
- data/lib/qtc/cli/mar/apps.rb +116 -125
- data/lib/qtc/cli/mar/base.rb +60 -60
- data/lib/qtc/cli/mar/commands.rb +221 -199
- data/lib/qtc/cli/mar/debug.rb +87 -86
- data/lib/qtc/cli/mar/domains.rb +35 -38
- data/lib/qtc/cli/mar/env.rb +38 -40
- data/lib/qtc/cli/mar/repository.rb +24 -26
- data/lib/qtc/cli/mar/ssl_certificates.rb +40 -42
- data/lib/qtc/cli/mar/stack.rb +29 -0
- data/lib/qtc/cli/mdb/base.rb +47 -43
- data/lib/qtc/cli/mdb/commands.rb +43 -31
- data/lib/qtc/cli/mdb/instances.rb +79 -60
- data/lib/qtc/cli/platform/clouds.rb +33 -15
- data/lib/qtc/cli/platform/commands.rb +132 -65
- data/lib/qtc/cli/platform/datacenters.rb +23 -21
- data/lib/qtc/cli/platform/ssh_keys.rb +41 -41
- data/lib/qtc/cli/platform/user.rb +25 -25
- data/lib/qtc/cli/platform/vpn.rb +93 -0
- data/lib/qtc/client.rb +170 -170
- data/lib/qtc/eds/client.rb +116 -116
- data/lib/qtc/eds/collection.rb +124 -124
- data/lib/qtc/eds/user_collection.rb +13 -13
- data/lib/qtc/eds/usergroup_collection.rb +41 -41
- data/lib/qtc/errors.rb +13 -11
- data/lib/qtc/version.rb +3 -3
- data/lib/qtc-sdk.rb +1 -1
- data/qtc-sdk.gemspec +28 -28
- data/spec/unit/qtc/client_spec.rb +147 -147
- metadata +20 -19
- data/lib/qtc/mws/client.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9bfa0619d71840645a97bcdcd7e127f0e3a99c7
|
4
|
+
data.tar.gz: ca672d82bb261648df83eac626cff20497a326cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8ae8f845101afa83f6fbade7093bd9687d08a3889fa9b7ac65ff502f541ca8aceb695cb9d4c09b1c0866ffbeca669b6fdc8aa3c8998412ff3e4da655aaa145f
|
7
|
+
data.tar.gz: b64b18daa1fda05d426481f9be1daedb8591016038986859f6bb1f4c304eea084e855ee31e83da6fa4586b0fd0fce103b0c94e77f6554c2ce03cf636a68f64e6
|
data/.gitignore
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
.idea
|
7
|
-
Gemfile.lock
|
8
|
-
InstalledFiles
|
9
|
-
_yardoc
|
10
|
-
coverage
|
11
|
-
doc/
|
12
|
-
lib/bundler/man
|
13
|
-
pkg
|
14
|
-
rdoc
|
15
|
-
spec/reports
|
16
|
-
test/tmp
|
17
|
-
test/version_tmp
|
18
|
-
tmp
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
.idea
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
data/Changelog.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
0.
|
2
|
-
-----------
|
3
|
-
|
4
|
-
- Add support for
|
5
|
-
- Add support for
|
6
|
-
-
|
1
|
+
0.3.0
|
2
|
+
-----------
|
3
|
+
|
4
|
+
- Add support for cloud vpn
|
5
|
+
- Add support for stack change
|
6
|
+
- Refactor cli to use cloud tokens
|
7
|
+
- Remove MWS support
|
8
|
+
|
9
|
+
0.2.0
|
10
|
+
-----------
|
11
|
+
|
12
|
+
- Add support for executing ad-hoc commands inside MAR applications: qtc-cli mar exec
|
13
|
+
- Add support for local debugging of MAR applications (using docker): qtc-cli mar local:run
|
14
|
+
- Add initial MDB commands: qtc-cli mdb list/logs
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in qtc-sdk.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in qtc-sdk.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2014 Jari Kolehmainen
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2014 Jari Kolehmainen
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
# Qt Cloud Services SDK for Ruby
|
2
|
-
|
3
|
-
This is Qt Cloud Services SDK for Ruby. What is Qt Cloud Services? See below:
|
4
|
-
|
5
|
-
* The Qt Cloud Services home page is at https://www.qtc.io
|
6
|
-
* The Developer Documentation page is at https://developer.qtc.io
|
7
|
-
|
8
|
-
## Getting Started
|
9
|
-
|
10
|
-
You can find a getting started guide for Qt Cloud Services at:
|
11
|
-
|
12
|
-
http://developer.qtc.io/qtc/getting-started?snippets=ruby
|
13
|
-
|
14
|
-
If you are looking for service specific guides, please see:
|
15
|
-
|
16
|
-
* [Enginio Data Storage](http://developer.qtc.io/eds/getting-started?snippets=ruby)
|
17
|
-
* [Managed Application Runtime](http://developer.qtc.io/mar/getting-started?snippets=ruby)
|
18
|
-
|
19
|
-
|
20
|
-
## Installation
|
21
|
-
|
22
|
-
Add this line to your application's Gemfile:
|
23
|
-
|
24
|
-
gem 'qtc-sdk'
|
25
|
-
|
26
|
-
And then execute:
|
27
|
-
|
28
|
-
$ bundle
|
29
|
-
|
30
|
-
Or install it yourself as:
|
31
|
-
|
32
|
-
$ gem install qtc-sdk
|
33
|
-
|
34
|
-
## Usage
|
35
|
-
|
36
|
-
TODO: Write usage instructions here
|
37
|
-
|
38
|
-
## Contributing
|
39
|
-
|
40
|
-
1. Fork it ( http://github.com/
|
41
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
-
5. Create new Pull Request
|
1
|
+
# Qt Cloud Services SDK for Ruby
|
2
|
+
|
3
|
+
This is Qt Cloud Services SDK for Ruby. What is Qt Cloud Services? See below:
|
4
|
+
|
5
|
+
* The Qt Cloud Services home page is at https://www.qtc.io
|
6
|
+
* The Developer Documentation page is at https://developer.qtc.io
|
7
|
+
|
8
|
+
## Getting Started
|
9
|
+
|
10
|
+
You can find a getting started guide for Qt Cloud Services at:
|
11
|
+
|
12
|
+
http://developer.qtc.io/qtc/getting-started?snippets=ruby
|
13
|
+
|
14
|
+
If you are looking for service specific guides, please see:
|
15
|
+
|
16
|
+
* [Enginio Data Storage](http://developer.qtc.io/eds/getting-started?snippets=ruby)
|
17
|
+
* [Managed Application Runtime](http://developer.qtc.io/mar/getting-started?snippets=ruby)
|
18
|
+
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Add this line to your application's Gemfile:
|
23
|
+
|
24
|
+
gem 'qtc-sdk'
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install qtc-sdk
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
TODO: Write usage instructions here
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it ( http://github.com/qtcloudservices/qtc-sdk-ruby/fork )
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/qtc-cli
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
# resolve bin path, ignoring symlinks
|
5
|
-
require 'pathname'
|
6
|
-
bin_file = Pathname.new(__FILE__).realpath
|
7
|
-
|
8
|
-
# add self to libpath
|
9
|
-
$:.unshift File.expand_path('../../lib', bin_file)
|
10
|
-
|
11
|
-
STDOUT.sync = true
|
12
|
-
|
13
|
-
require 'commander/import'
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
# resolve bin path, ignoring symlinks
|
5
|
+
require 'pathname'
|
6
|
+
bin_file = Pathname.new(__FILE__).realpath
|
7
|
+
|
8
|
+
# add self to libpath
|
9
|
+
$:.unshift File.expand_path('../../lib', bin_file)
|
10
|
+
|
11
|
+
STDOUT.sync = true
|
12
|
+
|
13
|
+
require 'commander/import'
|
14
14
|
require 'qtc/cli/commands'
|
data/lib/qtc/cli/commands.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'qtc/version'
|
2
|
-
|
3
|
-
module Qtc::Cli; end;
|
4
|
-
|
5
|
-
program :name, 'qtc-cli'
|
6
|
-
program :version, Qtc::VERSION
|
7
|
-
program :description, 'Command line interface for Qt Cloud Services'
|
8
|
-
|
9
|
-
default_command :help
|
10
|
-
never_trace!
|
11
|
-
|
12
|
-
require_relative 'platform/commands'
|
13
|
-
require_relative 'eds/commands'
|
14
|
-
require_relative 'mar/commands'
|
15
|
-
require_relative 'mdb/commands'
|
1
|
+
require 'qtc/version'
|
2
|
+
|
3
|
+
module Qtc::Cli; end;
|
4
|
+
|
5
|
+
program :name, 'qtc-cli'
|
6
|
+
program :version, Qtc::VERSION
|
7
|
+
program :description, 'Command line interface for Qt Cloud Services'
|
8
|
+
|
9
|
+
default_command :help
|
10
|
+
never_trace!
|
11
|
+
|
12
|
+
require_relative 'platform/commands'
|
13
|
+
require_relative 'eds/commands'
|
14
|
+
require_relative 'mar/commands'
|
15
|
+
require_relative 'mdb/commands'
|
data/lib/qtc/cli/common.rb
CHANGED
@@ -1,91 +1,146 @@
|
|
1
|
-
require 'inifile'
|
2
|
-
module Qtc
|
3
|
-
module Cli
|
4
|
-
module Common
|
5
|
-
|
6
|
-
attr_accessor :datacenter_id
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
def
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
|
1
|
+
require 'inifile'
|
2
|
+
module Qtc
|
3
|
+
module Cli
|
4
|
+
module Common
|
5
|
+
|
6
|
+
attr_accessor :datacenter_id
|
7
|
+
|
8
|
+
##
|
9
|
+
# @param [String] instance_id
|
10
|
+
def instance_info(instance_id)
|
11
|
+
instance_data = platform_client.get("/instances/#{instance_id}")
|
12
|
+
unless instance_data
|
13
|
+
abort("Error: instance not found")
|
14
|
+
end
|
15
|
+
|
16
|
+
instance_data
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# @return [String]
|
21
|
+
def current_cloud_id
|
22
|
+
unless @current_cloud_id
|
23
|
+
unless inifile['platform']['current_cloud']
|
24
|
+
raise ArgumentError.new("Please specify used cloud first: qtc-cli clouds:use <id>")
|
25
|
+
end
|
26
|
+
@current_cloud_id = inifile['platform']['current_cloud']
|
27
|
+
self.datacenter_id = inifile['platform']['current_dc']
|
28
|
+
end
|
29
|
+
@current_cloud_id
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# @return [String]
|
34
|
+
def current_cloud_dc
|
35
|
+
unless @current_cloud_dc
|
36
|
+
unless inifile['platform']['current_cloud']
|
37
|
+
raise ArgumentError.new("Please specify used cloud first: qtc-cli clouds:use <id>")
|
38
|
+
end
|
39
|
+
@current_cloud_dc = inifile['platform']['current_dc']
|
40
|
+
end
|
41
|
+
@current_cloud_dc
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# @return [String]
|
46
|
+
def current_cloud_token
|
47
|
+
token = nil
|
48
|
+
begin
|
49
|
+
authorizations = platform_client.get("/accounts/#{current_cloud_id}/authorizations")
|
50
|
+
unless authorizations['results'][0]
|
51
|
+
platform_client.post("/accounts/#{current_cloud_id}/authorizations", {})
|
52
|
+
raise StandardError.new "retry"
|
53
|
+
end
|
54
|
+
token = authorizations['results'][0]['access_token']
|
55
|
+
rescue ArgumentError => e
|
56
|
+
raise e
|
57
|
+
rescue Qtc::Errors::StandardError => e
|
58
|
+
if e.status == 404
|
59
|
+
raise ArgumentError.new("Cloud not found. Please specify used cloud first: qtc-cli clouds:use <id>")
|
60
|
+
end
|
61
|
+
rescue => e
|
62
|
+
retry
|
63
|
+
end
|
64
|
+
|
65
|
+
token
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# @param [String] token
|
70
|
+
# @return [Qtc::Client]
|
71
|
+
def platform_client(token = nil)
|
72
|
+
inifile['platform']['token'] = token unless token.nil?
|
73
|
+
unless inifile['platform']['token']
|
74
|
+
raise ArgumentError.new("Please login first using: qtc-cli login")
|
75
|
+
end
|
76
|
+
|
77
|
+
if @platform_client.nil?
|
78
|
+
@platform_client = Qtc::Client.new(platform_base_url, {'Authorization' => "Bearer #{inifile['platform']['token']}"})
|
79
|
+
end
|
80
|
+
|
81
|
+
@platform_client
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# @return [String]
|
86
|
+
def ini_filename
|
87
|
+
File.join(Dir.home, '/.qtc_client')
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# @return [Hash]
|
92
|
+
def inifile
|
93
|
+
if @inifile.nil?
|
94
|
+
if File.exists?(ini_filename)
|
95
|
+
@inifile = IniFile.load(ini_filename)
|
96
|
+
else
|
97
|
+
@inifile = IniFile.new
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
unless @inifile['platform']
|
102
|
+
@inifile['platform'] = {}
|
103
|
+
end
|
104
|
+
|
105
|
+
@inifile
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# @param [String,NilClass]
|
110
|
+
# @return [String]
|
111
|
+
def extract_app_in_dir(remote = nil)
|
112
|
+
if File.exists?(File.expand_path('./.git/config'))
|
113
|
+
remotes = []
|
114
|
+
git_remotes = `git remote -v`
|
115
|
+
git_remotes.lines.each do |line|
|
116
|
+
if match = line.match(/#{remote}\s+git@git-mar-(.*)\:(.*) \(push\)/)
|
117
|
+
remotes << match[2]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
apps = remotes.uniq
|
121
|
+
if apps.size == 1
|
122
|
+
return apps[0]
|
123
|
+
elsif apps.size > 1
|
124
|
+
raise ArgumentError.new("Multiple app git remotes\nSpecify app with --remote REMOTE or --app APP")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# @return [Qtc::Client]
|
131
|
+
def client
|
132
|
+
if @client.nil?
|
133
|
+
@client = Qtc::Client.new(base_url)
|
134
|
+
end
|
135
|
+
|
136
|
+
@client
|
137
|
+
end
|
138
|
+
|
139
|
+
##
|
140
|
+
# @return [String]
|
141
|
+
def platform_base_url
|
142
|
+
ENV['QTC_PLATFORM_URL'] || 'https://api.qtc.io/v1'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/lib/qtc/cli/eds/base.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
require 'qtc/client'
|
2
|
-
require_relative '../common'
|
3
|
-
|
4
|
-
module Qtc
|
5
|
-
module Cli
|
6
|
-
module Eds
|
7
|
-
class Base
|
8
|
-
include Cli::Common
|
9
|
-
|
10
|
-
protected
|
11
|
-
|
12
|
-
##
|
13
|
-
# @return [Qtc::Client]
|
14
|
-
def client
|
15
|
-
if @client.nil?
|
16
|
-
@client = Qtc::Client.new(base_url)
|
17
|
-
end
|
18
|
-
|
19
|
-
@client
|
20
|
-
end
|
21
|
-
|
22
|
-
def base_url
|
23
|
-
ENV['QTC_EDS_URL'] || 'https://api.engin.io/v1'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
1
|
+
require 'qtc/client'
|
2
|
+
require_relative '../common'
|
3
|
+
|
4
|
+
module Qtc
|
5
|
+
module Cli
|
6
|
+
module Eds
|
7
|
+
class Base
|
8
|
+
include Cli::Common
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
##
|
13
|
+
# @return [Qtc::Client]
|
14
|
+
def client
|
15
|
+
if @client.nil?
|
16
|
+
@client = Qtc::Client.new(base_url)
|
17
|
+
end
|
18
|
+
|
19
|
+
@client
|
20
|
+
end
|
21
|
+
|
22
|
+
def base_url
|
23
|
+
ENV['QTC_EDS_URL'] || 'https://api.engin.io/v1'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
28
|
end
|
data/lib/qtc/cli/eds/commands.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
require_relative 'instances'
|
2
|
-
|
3
|
-
command 'eds list' do |c|
|
4
|
-
c.syntax = 'qtc-cli eds list'
|
5
|
-
c.description = 'List all EDS instances'
|
6
|
-
c.action do |args, options|
|
7
|
-
Qtc::Cli::Eds::Instances.new.list
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
command 'eds create' do |c|
|
12
|
-
c.syntax = 'qtc-cli eds create <CLOUD_ID> <NAME>'
|
13
|
-
c.description = 'Create a new EDS instance'
|
14
|
-
c.example 'Create new EDS instance "My Backend" to cloud "46738209-a745-4841-8eeb-1ca0672aa6v8"', 'qtc-cli eds create 46738209-a745-4841-8eeb-1ca0672aa6v8 "My Backend"'
|
15
|
-
c.action do |args, options|
|
16
|
-
raise ArgumentError.new('CLOUD_ID is required') if args[0].nil?
|
17
|
-
raise ArgumentError.new('NAME is required') if args[1].nil?
|
18
|
-
Qtc::Cli::Eds::Instances.new.create(args[0], args[1])
|
19
|
-
end
|
20
|
-
end
|
1
|
+
require_relative 'instances'
|
2
|
+
|
3
|
+
command 'eds list' do |c|
|
4
|
+
c.syntax = 'qtc-cli eds list'
|
5
|
+
c.description = 'List all EDS instances'
|
6
|
+
c.action do |args, options|
|
7
|
+
Qtc::Cli::Eds::Instances.new.list
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
command 'eds create' do |c|
|
12
|
+
c.syntax = 'qtc-cli eds create <CLOUD_ID> <NAME>'
|
13
|
+
c.description = 'Create a new EDS instance'
|
14
|
+
c.example 'Create new EDS instance "My Backend" to cloud "46738209-a745-4841-8eeb-1ca0672aa6v8"', 'qtc-cli eds create 46738209-a745-4841-8eeb-1ca0672aa6v8 "My Backend"'
|
15
|
+
c.action do |args, options|
|
16
|
+
raise ArgumentError.new('CLOUD_ID is required') if args[0].nil?
|
17
|
+
raise ArgumentError.new('NAME is required') if args[1].nil?
|
18
|
+
Qtc::Cli::Eds::Instances.new.create(args[0], args[1])
|
19
|
+
end
|
20
|
+
end
|