smartdc 0.4.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +0 -1
- data/.travis.yml +5 -0
- data/Gemfile +7 -10
- data/README.md +42 -69
- data/Rakefile +47 -0
- data/VERSION +1 -1
- data/bin/sdc +327 -0
- data/lib/cli_helper.rb +131 -8
- data/lib/configure.rb +73 -0
- data/lib/smartdc.rb +16 -1
- data/lib/smartdc/api/analytics.rb +29 -7
- data/lib/smartdc/api/analytics/heatmap.rb +20 -0
- data/lib/smartdc/api/datacenters.rb +6 -7
- data/lib/smartdc/api/datasets.rb +6 -7
- data/lib/smartdc/api/keys.rb +10 -11
- data/lib/smartdc/api/machine/metadata.rb +9 -15
- data/lib/smartdc/api/machine/snapshots.rb +16 -16
- data/lib/smartdc/api/machine/tags.rb +11 -12
- data/lib/smartdc/api/machines.rb +23 -23
- data/lib/smartdc/api/packages.rb +7 -8
- data/lib/smartdc/client.rb +14 -18
- data/lib/smartdc/request.rb +41 -51
- data/lib/smartdc/response.rb +24 -0
- data/lib/smartdc/response/raise_error.rb +1 -1
- data/smartdc.gemspec +51 -90
- data/spec/fixtures/analytics.json +26 -0
- data/spec/fixtures/datacenter.json +4 -0
- data/spec/fixtures/datacenters.json +3 -0
- data/spec/fixtures/datasets.json +38 -0
- data/spec/fixtures/keys.json +14 -0
- data/spec/fixtures/machines.json +36 -0
- data/spec/fixtures/packages.json +18 -0
- data/spec/fixtures/snapshots.json +8 -0
- data/spec/fixtures/tag.json +3 -0
- data/spec/spec_helper.rb +3 -12
- data/spec/unit/smartdc/api/analytics_spec.rb +53 -0
- data/spec/unit/smartdc/api/datacenters_spec.rb +31 -0
- data/spec/unit/smartdc/api/datasets_spec.rb +31 -0
- data/spec/unit/smartdc/api/keys_spec.rb +53 -0
- data/spec/unit/smartdc/api/machine/metadata_spec.rb +42 -0
- data/spec/unit/smartdc/api/machine/snapshots_spec.rb +132 -0
- data/spec/unit/smartdc/api/machine/tags_spec.rb +53 -0
- data/spec/unit/smartdc/api/machines_spec.rb +53 -0
- data/spec/unit/smartdc/api/packages_spec.rb +31 -0
- data/spec/{smartdc → unit/smartdc}/client_spec.rb +0 -6
- data/spec/{smartdc_spec.rb → unit/smartdc_spec.rb} +1 -1
- metadata +72 -140
- data/LICENSE.md +0 -20
- data/bin/sdc-addmachinemetadata +0 -29
- data/bin/sdc-addmachinetag +0 -29
- data/bin/sdc-createinstrumentation +0 -27
- data/bin/sdc-createkey +0 -32
- data/bin/sdc-createmachine +0 -39
- data/bin/sdc-createmachinesnapshot +0 -27
- data/bin/sdc-deleteinstrumentation +0 -12
- data/bin/sdc-deletekey +0 -12
- data/bin/sdc-deletemachine +0 -12
- data/bin/sdc-deletemachinemetadata +0 -29
- data/bin/sdc-deletemachinesnapshot +0 -29
- data/bin/sdc-deletemachinetag +0 -29
- data/bin/sdc-describeanalytics +0 -10
- data/bin/sdc-getdatacenter +0 -10
- data/bin/sdc-getdataset +0 -10
- data/bin/sdc-getinstrumentation +0 -31
- data/bin/sdc-getkey +0 -10
- data/bin/sdc-getmachine +0 -12
- data/bin/sdc-getmachinemetadata +0 -12
- data/bin/sdc-getmachinesnapshot +0 -27
- data/bin/sdc-getmachinetag +0 -27
- data/bin/sdc-getpackage +0 -10
- data/bin/sdc-listdatacenters +0 -10
- data/bin/sdc-listdatasets +0 -10
- data/bin/sdc-listinstrumentations +0 -10
- data/bin/sdc-listkeys +0 -10
- data/bin/sdc-listmachines +0 -10
- data/bin/sdc-listmachinesnapshots +0 -10
- data/bin/sdc-listmachinetags +0 -10
- data/bin/sdc-listpackages +0 -10
- data/bin/sdc-rebootmachine +0 -12
- data/bin/sdc-resizemachine +0 -34
- data/bin/sdc-setup +0 -67
- data/bin/sdc-startmachine +0 -12
- data/bin/sdc-startmachinefromsnapshot +0 -29
- data/bin/sdc-stopmachine +0 -12
- data/config/fixtures/instrumentation.json +0 -4
- data/config/fixtures/key.json +0 -4
- data/config/fixtures/tag.json +0 -3
- data/lib/smartdc/api/analytics/instrumentations.rb +0 -44
- data/lib/smartdc/response/mashify.rb +0 -29
- data/lib/smartdc/response/parse_json.rb +0 -26
- data/spec/smartdc/api/analytics_spec.rb +0 -32
- data/spec/smartdc/api/datacenters_spec.rb +0 -16
- data/spec/smartdc/api/datasets_spec.rb +0 -16
- data/spec/smartdc/api/keys_spec.rb +0 -32
- data/spec/smartdc/api/machine/metadata_spec.rb +0 -59
- data/spec/smartdc/api/machine/snapshots_spec.rb +0 -70
- data/spec/smartdc/api/machine/tags_spec.rb +0 -65
- data/spec/smartdc/api/machines_spec.rb +0 -92
- data/spec/smartdc/api/packages_spec.rb +0 -16
- data/spec/smartdc/request_spec.rb +0 -12
data/LICENSE.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 ogom
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/sdc-addmachinemetadata
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} machine.id [options]"
|
9
|
-
opts.on('-k', '--key [NAME]', 'Key Tag.') {|v| options[:key] = v }
|
10
|
-
opts.on('-v', '--value [NAME]', 'Value Tag.') {|v| options[:value] = v }
|
11
|
-
opts.on_tail('-h','--help') do
|
12
|
-
puts opts
|
13
|
-
exit
|
14
|
-
end
|
15
|
-
|
16
|
-
begin
|
17
|
-
opts.parse!(ARGV)
|
18
|
-
rescue => e
|
19
|
-
puts e.to_s << "\n" << opts.to_s
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
begin
|
25
|
-
metadata = {options[:key] => options[:value]}
|
26
|
-
puts client.machines(ARGV[0]).metadata.create metadata
|
27
|
-
rescue => e
|
28
|
-
puts e.inspect
|
29
|
-
end
|
data/bin/sdc-addmachinetag
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} machine.id [options]"
|
9
|
-
opts.on('-k', '--key [NAME]', 'Key Tag.') {|v| options[:key] = v }
|
10
|
-
opts.on('-v', '--value [NAME]', 'Value Tag.') {|v| options[:value] = v }
|
11
|
-
opts.on_tail('-h','--help') do
|
12
|
-
puts opts
|
13
|
-
exit
|
14
|
-
end
|
15
|
-
|
16
|
-
begin
|
17
|
-
opts.parse!(ARGV)
|
18
|
-
rescue => e
|
19
|
-
puts e.to_s << "\n" << opts.to_s
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
begin
|
25
|
-
tag = {options[:key] => options[:value]}
|
26
|
-
puts client.machines(ARGV[0]).tags.create tag
|
27
|
-
rescue => e
|
28
|
-
puts e.inspect
|
29
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.on('-m', '--module NAME', 'The CA module.') {|v| options[:module] = v }
|
9
|
-
opts.on('-s', '--stat NAME', 'The CA stat.') {|v| options[:stat] = v }
|
10
|
-
opts.on('-h','--help') do
|
11
|
-
puts opts
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
opts.parse!(ARGV)
|
17
|
-
rescue => e
|
18
|
-
puts e.to_s << "\n" << opts.to_s
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
puts client.analytics.instrumentations.create options
|
25
|
-
rescue => e
|
26
|
-
puts e.inspect
|
27
|
-
end
|
data/bin/sdc-createkey
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
key = {}
|
7
|
-
name = ARGV[0]
|
8
|
-
if name
|
9
|
-
key[:name] = name
|
10
|
-
else
|
11
|
-
puts 'name is empty.'
|
12
|
-
exit 1
|
13
|
-
end
|
14
|
-
|
15
|
-
key_file = ARGV[1]
|
16
|
-
if key_file
|
17
|
-
begin
|
18
|
-
key[:key] = File.read(key_file)
|
19
|
-
rescue => e
|
20
|
-
puts e
|
21
|
-
exit 1
|
22
|
-
end
|
23
|
-
else
|
24
|
-
puts 'key file is empty.'
|
25
|
-
exit 1
|
26
|
-
end
|
27
|
-
|
28
|
-
begin
|
29
|
-
puts client.keys.create key
|
30
|
-
rescue => e
|
31
|
-
puts e.inspect
|
32
|
-
end
|
data/bin/sdc-createmachine
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.on('-n', '--name NAME', 'friendly name for this machine.') {|v| options[:name] = v }
|
9
|
-
opts.on('-e', '--dataset URN', 'dataset URN.') {|v| options[:dataset] = v }
|
10
|
-
opts.on('-p', '--package NAME', 'Name of the package to use on provisioning.') {|v| options[:package] = v }
|
11
|
-
opts.on('-h','--help') do
|
12
|
-
puts opts
|
13
|
-
print "\n" + 'Datasets(urn):'
|
14
|
-
fixture('datasets').each do |dataset|
|
15
|
-
print ' ' + dataset['urn']
|
16
|
-
end
|
17
|
-
print "\n\n" + 'Packages(name):'
|
18
|
-
fixture('packages').each do |packages|
|
19
|
-
print ' ' + packages['name']
|
20
|
-
end
|
21
|
-
puts
|
22
|
-
exit
|
23
|
-
end
|
24
|
-
|
25
|
-
begin
|
26
|
-
opts.parse!(ARGV)
|
27
|
-
rescue => e
|
28
|
-
puts e.to_s << "\n" << opts.to_s
|
29
|
-
exit
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
begin
|
34
|
-
puts client.machines.create options
|
35
|
-
rescue Smartdc::Error::Conflict => e
|
36
|
-
puts e
|
37
|
-
rescue => e
|
38
|
-
puts e.inspect
|
39
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} machine.id [options]"
|
9
|
-
opts.on('-n', '--name NAME', 'The name to assign to the new snapshot.') {|v| options[:name] = v }
|
10
|
-
opts.on_tail('-h','--help') do
|
11
|
-
puts opts
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
opts.parse!(ARGV)
|
17
|
-
rescue => e
|
18
|
-
puts e.to_s << "\n" << opts.to_s
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
puts client.machines(ARGV[0]).snapshots.create options
|
25
|
-
rescue => e
|
26
|
-
puts e.inspect
|
27
|
-
end
|
data/bin/sdc-deletekey
DELETED
data/bin/sdc-deletemachine
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} machine.id [options]"
|
9
|
-
opts.on('-k', '--key [NAME]', 'Key Tag.') {|v| options[:key] = v }
|
10
|
-
opts.on_tail('-h','--help') do
|
11
|
-
puts opts
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
opts.parse!(ARGV)
|
17
|
-
rescue => e
|
18
|
-
puts e.to_s << "\n" << opts.to_s
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
client.machines(ARGV[0]).metadata(options[:key]).delete
|
25
|
-
rescue => e
|
26
|
-
puts e.inspect
|
27
|
-
else
|
28
|
-
puts "Success"
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} machine.id [options]"
|
9
|
-
opts.on('-n', '--name NAME', 'snapshot name.') {|v| options[:name] = v }
|
10
|
-
opts.on_tail('-h','--help') do
|
11
|
-
puts opts
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
opts.parse!(ARGV)
|
17
|
-
rescue => e
|
18
|
-
puts e.to_s << "\n" << opts.to_s
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
client.machines(ARGV[0]).snapshots(options[:name]).delete
|
25
|
-
rescue => e
|
26
|
-
puts e.inspect
|
27
|
-
else
|
28
|
-
puts "Success"
|
29
|
-
end
|
data/bin/sdc-deletemachinetag
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} machine.id [options]"
|
9
|
-
opts.on('-k', '--key [NAME]', 'Key Tag.') {|v| options[:key] = v }
|
10
|
-
opts.on_tail('-h','--help') do
|
11
|
-
puts opts
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
opts.parse!(ARGV)
|
17
|
-
rescue => e
|
18
|
-
puts e.to_s << "\n" << opts.to_s
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
client.machines(ARGV[0]).tags(options[:key]).delete
|
25
|
-
rescue => e
|
26
|
-
puts e.inspect
|
27
|
-
else
|
28
|
-
puts "Success"
|
29
|
-
end
|
data/bin/sdc-describeanalytics
DELETED
data/bin/sdc-getdatacenter
DELETED
data/bin/sdc-getdataset
DELETED
data/bin/sdc-getinstrumentation
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
require 'cli_helper'
|
5
|
-
|
6
|
-
options = {}
|
7
|
-
OptionParser.new do |opts|
|
8
|
-
opts.banner = "Usage: #{File.basename($0)} instrumentation.id [options]"
|
9
|
-
opts.on('-v', '--value', 'value raw') { options[:value] = true }
|
10
|
-
opts.on_tail('-h','--help') do
|
11
|
-
puts opts
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
begin
|
16
|
-
opts.parse!(ARGV)
|
17
|
-
rescue => e
|
18
|
-
puts e.to_s << "\n" << opts.to_s
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
begin
|
24
|
-
if options[:value]
|
25
|
-
puts client.analytics.instrumentations(ARGV[0]).value
|
26
|
-
else
|
27
|
-
puts client.analytics.instrumentations(ARGV[0]).read
|
28
|
-
end
|
29
|
-
rescue => e
|
30
|
-
puts e.inspect
|
31
|
-
end
|
data/bin/sdc-getkey
DELETED
data/bin/sdc-getmachine
DELETED