smartdc 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -19
- data/.travis.yml +1 -1
- data/Gemfile +5 -11
- data/README.md +25 -40
- data/Rakefile +5 -5
- data/bin/sdc +4 -380
- data/config.ru +2 -0
- data/lib/smartdc.rb +23 -15
- data/lib/smartdc/api/analytics.rb +19 -36
- data/lib/smartdc/api/analytics/heatmap.rb +6 -15
- data/lib/smartdc/api/datacenters.rb +7 -16
- data/lib/smartdc/api/images.rb +11 -0
- data/lib/smartdc/api/keys.rb +13 -23
- data/lib/smartdc/api/machines.rb +26 -60
- data/lib/smartdc/api/machines/metadata.rb +15 -0
- data/lib/smartdc/api/machines/snapshots.rb +23 -0
- data/lib/smartdc/api/machines/tags.rb +19 -0
- data/lib/smartdc/api/packages.rb +7 -17
- data/lib/smartdc/auth.rb +39 -5
- data/lib/smartdc/cli.rb +65 -0
- data/lib/smartdc/cli/analytic.rb +52 -0
- data/lib/smartdc/cli/datacenter.rb +15 -0
- data/lib/smartdc/cli/image.rb +19 -0
- data/lib/smartdc/cli/key.rb +26 -0
- data/lib/smartdc/cli/machine.rb +79 -0
- data/lib/smartdc/cli/machine/metadata.rb +30 -0
- data/lib/smartdc/cli/machine/snapshot.rb +38 -0
- data/lib/smartdc/cli/machine/tag.rb +33 -0
- data/lib/smartdc/cli/package.rb +17 -0
- data/lib/smartdc/cli_configure.rb +81 -0
- data/lib/smartdc/cli_helper.rb +111 -0
- data/lib/smartdc/client.rb +33 -28
- data/lib/smartdc/configure.rb +30 -0
- data/lib/smartdc/default.rb +35 -0
- data/lib/smartdc/version.rb +1 -1
- data/smartdc.gemspec +20 -16
- data/spec/cassettes/analytics/create.yml +64 -0
- data/spec/cassettes/analytics/describe.yml +123 -0
- data/spec/cassettes/analytics/destroy.yml +56 -0
- data/spec/cassettes/analytics/index.yml +62 -0
- data/spec/cassettes/analytics/show.yml +62 -0
- data/spec/cassettes/analytics/value.yml +62 -0
- data/spec/cassettes/datacenters/index.yml +62 -0
- data/spec/cassettes/datacenters/show.yml +64 -0
- data/spec/cassettes/images/index.yml +519 -0
- data/spec/cassettes/images/show.yml +63 -0
- data/spec/cassettes/keys/create.yml +65 -0
- data/spec/cassettes/keys/destroy.yml +56 -0
- data/spec/cassettes/keys/index.yml +63 -0
- data/spec/cassettes/keys/show.yml +63 -0
- data/spec/cassettes/machines/create.yml +65 -0
- data/spec/cassettes/machines/destroy.yml +56 -0
- data/spec/cassettes/machines/index.yml +67 -0
- data/spec/cassettes/machines/metadata/destroy.yml +56 -0
- data/spec/cassettes/machines/metadata/index.yml +62 -0
- data/spec/cassettes/machines/metadata/update.yml +64 -0
- data/spec/cassettes/machines/reboot.yml +58 -0
- data/spec/cassettes/machines/show.yml +63 -0
- data/spec/cassettes/machines/snapshots/create.yml +62 -0
- data/spec/cassettes/machines/snapshots/destroy.yml +56 -0
- data/spec/cassettes/machines/snapshots/index.yml +62 -0
- data/spec/cassettes/machines/snapshots/show.yml +62 -0
- data/spec/cassettes/machines/snapshots/start.yml +58 -0
- data/spec/cassettes/machines/start.yml +58 -0
- data/spec/cassettes/machines/stop.yml +58 -0
- data/spec/cassettes/machines/tags/create.yml +64 -0
- data/spec/cassettes/machines/tags/destroy.yml +56 -0
- data/spec/cassettes/machines/tags/index.yml +62 -0
- data/spec/cassettes/machines/tags/show.yml +62 -0
- data/spec/cassettes/packages/index.yml +123 -0
- data/spec/cassettes/packages/show.yml +63 -0
- data/spec/fixtures/config/sdccfg +4 -0
- data/spec/fixtures/ssh/id_rsa +27 -0
- data/spec/fixtures/ssh/id_rsa.pub +1 -0
- data/spec/smartdc/api/analytics_spec.rb +47 -0
- data/spec/smartdc/api/datacenters_spec.rb +19 -0
- data/spec/smartdc/api/images_spec.rb +19 -0
- data/spec/smartdc/api/keys_spec.rb +34 -0
- data/spec/smartdc/api/machines/metadata_spec.rb +27 -0
- data/spec/smartdc/api/machines/snapshots_spec.rb +38 -0
- data/spec/smartdc/api/machines/tags_spec.rb +33 -0
- data/spec/smartdc/api/machines_spec.rb +59 -0
- data/spec/smartdc/api/packages_spec.rb +19 -0
- data/spec/smartdc/auth_spec.rb +25 -0
- data/spec/smartdc/cli_configure_spec.rb +32 -0
- data/spec/smartdc/client_spec.rb +11 -0
- data/spec/smartdc_spec.rb +44 -0
- data/spec/spec_helper.rb +25 -8
- metadata +176 -83
- data/lib/cli_helper.rb +0 -126
- data/lib/configure.rb +0 -125
- data/lib/smartdc/api/datasets.rb +0 -20
- data/lib/smartdc/api/machine/metadata.rb +0 -24
- data/lib/smartdc/api/machine/snapshots.rb +0 -35
- data/lib/smartdc/api/machine/tags.rb +0 -29
- data/lib/smartdc/error.rb +0 -35
- data/lib/smartdc/request.rb +0 -83
- data/lib/smartdc/response.rb +0 -25
- data/lib/smartdc/response/raise_error.rb +0 -38
- data/spec/fixtures/analytics.json +0 -26
- data/spec/fixtures/datacenter.json +0 -4
- data/spec/fixtures/datacenters.json +0 -3
- data/spec/fixtures/datasets.json +0 -38
- data/spec/fixtures/keys.json +0 -14
- data/spec/fixtures/machines.json +0 -36
- data/spec/fixtures/packages.json +0 -18
- data/spec/fixtures/snapshots.json +0 -8
- data/spec/fixtures/tag.json +0 -3
- data/spec/unit/smartdc/api/analytics_spec.rb +0 -48
- data/spec/unit/smartdc/api/datacenters_spec.rb +0 -28
- data/spec/unit/smartdc/api/datasets_spec.rb +0 -28
- data/spec/unit/smartdc/api/keys_spec.rb +0 -48
- data/spec/unit/smartdc/api/machine/metadata_spec.rb +0 -38
- data/spec/unit/smartdc/api/machine/snapshots_spec.rb +0 -48
- data/spec/unit/smartdc/api/machine/tags_spec.rb +0 -48
- data/spec/unit/smartdc/api/machines_spec.rb +0 -48
- data/spec/unit/smartdc/api/packages_spec.rb +0 -28
- data/spec/unit/smartdc/client_spec.rb +0 -40
- data/spec/unit/smartdc_spec.rb +0 -9
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Smartdc::Api::Machine::Tags do
|
4
|
-
|
5
|
-
let(:object) {Object.new}
|
6
|
-
let(:request) {Smartdc::Request}
|
7
|
-
let(:tags) {Smartdc::Api::Machine::Tags.new('id', {})}
|
8
|
-
|
9
|
-
describe ".create" do
|
10
|
-
it "creates a tag" do
|
11
|
-
object.stub(:content) {fixture('tag')}
|
12
|
-
tag = object.content
|
13
|
-
request.stub_chain(:new, :post).with('my/machines/id/tags/', tag) {object}
|
14
|
-
|
15
|
-
expect(tags.create(tag).content).to eq(tag)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".read" do
|
20
|
-
it "return a tag" do
|
21
|
-
object.stub(:content) {fixture('tag')}
|
22
|
-
key = object.content.first[0]
|
23
|
-
request.stub_chain(:new, :get).with('my/machines/id/tags/' + key) {object}
|
24
|
-
|
25
|
-
expect(tags.read(key).content.first[0]).to eq(key)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe ".all" do
|
30
|
-
it "return some tags" do
|
31
|
-
object.stub(:content) {fixture('tag')}
|
32
|
-
request.stub_chain(:new, :get).with('my/machines/id/tags', {}) {object}
|
33
|
-
|
34
|
-
expect(tags.all.content.count).to be > 0
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe ".destroy" do
|
39
|
-
it "return a tag" do
|
40
|
-
object.stub(:status) {204}
|
41
|
-
key = fixture('tag').first[0]
|
42
|
-
request.stub_chain(:new, :del).with('my/machines/id/tags/' + key) {object}
|
43
|
-
|
44
|
-
expect(tags.destroy(key).status).to eq(204)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Smartdc::Api::Machines do
|
4
|
-
|
5
|
-
let(:object) {Object.new}
|
6
|
-
let(:request) {Smartdc::Request}
|
7
|
-
let(:machines) {Smartdc::Api::Machines.new({})}
|
8
|
-
|
9
|
-
describe ".create" do
|
10
|
-
it "creates a machine" do
|
11
|
-
object.stub(:content) {fixture('machines')[0]}
|
12
|
-
machine = object.content
|
13
|
-
request.stub_chain(:new, :post).with('my/machines/', machine) {object}
|
14
|
-
|
15
|
-
expect(machines.create(machine).content['name']).to eq(machine['name'])
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".read" do
|
20
|
-
it "returns a machine" do
|
21
|
-
object.stub(:content) {fixture('machines')[0]}
|
22
|
-
name = object.content['name']
|
23
|
-
request.stub_chain(:new, :get).with('my/machines/' + name) {object}
|
24
|
-
|
25
|
-
expect(machines.read(name).content['name']).to eq(name)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe ".all" do
|
30
|
-
it "returns some machines" do
|
31
|
-
object.stub(:content) {fixture('machines')}
|
32
|
-
request.stub_chain(:new, :get).with('my/machines', {}) {object}
|
33
|
-
|
34
|
-
expect(machines.all.content.count).to be > 1
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe ".destroy" do
|
39
|
-
it "returns true when success" do
|
40
|
-
machine = fixture('machines')[0]
|
41
|
-
object.stub(:status) {204}
|
42
|
-
request.stub_chain(:new, :del).with('my/machines/' + machine['name']) {object}
|
43
|
-
|
44
|
-
expect(machines.destroy(machine['name']).status).to eq(204)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Smartdc::Api::Packages do
|
4
|
-
|
5
|
-
let(:object) {Object.new}
|
6
|
-
let(:request) {Smartdc::Request}
|
7
|
-
let(:packages) {Smartdc::Api::Packages.new({})}
|
8
|
-
|
9
|
-
describe ".read" do
|
10
|
-
it "returns a package" do
|
11
|
-
object.stub(:content) {fixture('packages')[0]}
|
12
|
-
name = object.content['name']
|
13
|
-
request.stub_chain(:new, :get).with('my/packages/' + name) {object}
|
14
|
-
|
15
|
-
expect(packages.read(name).content['name']).to eq(name)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".all" do
|
20
|
-
it "returns some packages" do
|
21
|
-
object.stub(:content) {fixture('packages')}
|
22
|
-
request.stub_chain(:new, :get).with('my/packages', {}) {object}
|
23
|
-
|
24
|
-
expect(packages.all.content.count).to be > 1
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Smartdc::Client do
|
4
|
-
describe ".keys" do
|
5
|
-
it "is a Smartdc::Api::Keys" do
|
6
|
-
expect(Smartdc::Client.new.keys).to be_a Smartdc::Api::Keys
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
describe ".datacenters" do
|
11
|
-
it "is a Smartdc::Api::Datacenters" do
|
12
|
-
expect(Smartdc::Client.new.datacenters).to be_a Smartdc::Api::Datacenters
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe ".datasets" do
|
17
|
-
it "is a Smartdc::Api::Datasets" do
|
18
|
-
expect(Smartdc::Client.new.datasets).to be_a Smartdc::Api::Datasets
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe ".packages" do
|
23
|
-
it "is a Smartdc::Api::Packages" do
|
24
|
-
expect(Smartdc::Client.new.packages).to be_a Smartdc::Api::Packages
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe ".machines" do
|
29
|
-
it "is a Smartdc::Api::Machines" do
|
30
|
-
expect(Smartdc::Client.new.machines).to be_a Smartdc::Api::Machines
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe ".analytics" do
|
35
|
-
it "is a Smartdc::Api::Analytics" do
|
36
|
-
expect(Smartdc::Client.new.analytics).to be_a Smartdc::Api::Analytics
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|