smartdc 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -19
  3. data/.travis.yml +1 -1
  4. data/Gemfile +5 -11
  5. data/README.md +25 -40
  6. data/Rakefile +5 -5
  7. data/bin/sdc +4 -380
  8. data/config.ru +2 -0
  9. data/lib/smartdc.rb +23 -15
  10. data/lib/smartdc/api/analytics.rb +19 -36
  11. data/lib/smartdc/api/analytics/heatmap.rb +6 -15
  12. data/lib/smartdc/api/datacenters.rb +7 -16
  13. data/lib/smartdc/api/images.rb +11 -0
  14. data/lib/smartdc/api/keys.rb +13 -23
  15. data/lib/smartdc/api/machines.rb +26 -60
  16. data/lib/smartdc/api/machines/metadata.rb +15 -0
  17. data/lib/smartdc/api/machines/snapshots.rb +23 -0
  18. data/lib/smartdc/api/machines/tags.rb +19 -0
  19. data/lib/smartdc/api/packages.rb +7 -17
  20. data/lib/smartdc/auth.rb +39 -5
  21. data/lib/smartdc/cli.rb +65 -0
  22. data/lib/smartdc/cli/analytic.rb +52 -0
  23. data/lib/smartdc/cli/datacenter.rb +15 -0
  24. data/lib/smartdc/cli/image.rb +19 -0
  25. data/lib/smartdc/cli/key.rb +26 -0
  26. data/lib/smartdc/cli/machine.rb +79 -0
  27. data/lib/smartdc/cli/machine/metadata.rb +30 -0
  28. data/lib/smartdc/cli/machine/snapshot.rb +38 -0
  29. data/lib/smartdc/cli/machine/tag.rb +33 -0
  30. data/lib/smartdc/cli/package.rb +17 -0
  31. data/lib/smartdc/cli_configure.rb +81 -0
  32. data/lib/smartdc/cli_helper.rb +111 -0
  33. data/lib/smartdc/client.rb +33 -28
  34. data/lib/smartdc/configure.rb +30 -0
  35. data/lib/smartdc/default.rb +35 -0
  36. data/lib/smartdc/version.rb +1 -1
  37. data/smartdc.gemspec +20 -16
  38. data/spec/cassettes/analytics/create.yml +64 -0
  39. data/spec/cassettes/analytics/describe.yml +123 -0
  40. data/spec/cassettes/analytics/destroy.yml +56 -0
  41. data/spec/cassettes/analytics/index.yml +62 -0
  42. data/spec/cassettes/analytics/show.yml +62 -0
  43. data/spec/cassettes/analytics/value.yml +62 -0
  44. data/spec/cassettes/datacenters/index.yml +62 -0
  45. data/spec/cassettes/datacenters/show.yml +64 -0
  46. data/spec/cassettes/images/index.yml +519 -0
  47. data/spec/cassettes/images/show.yml +63 -0
  48. data/spec/cassettes/keys/create.yml +65 -0
  49. data/spec/cassettes/keys/destroy.yml +56 -0
  50. data/spec/cassettes/keys/index.yml +63 -0
  51. data/spec/cassettes/keys/show.yml +63 -0
  52. data/spec/cassettes/machines/create.yml +65 -0
  53. data/spec/cassettes/machines/destroy.yml +56 -0
  54. data/spec/cassettes/machines/index.yml +67 -0
  55. data/spec/cassettes/machines/metadata/destroy.yml +56 -0
  56. data/spec/cassettes/machines/metadata/index.yml +62 -0
  57. data/spec/cassettes/machines/metadata/update.yml +64 -0
  58. data/spec/cassettes/machines/reboot.yml +58 -0
  59. data/spec/cassettes/machines/show.yml +63 -0
  60. data/spec/cassettes/machines/snapshots/create.yml +62 -0
  61. data/spec/cassettes/machines/snapshots/destroy.yml +56 -0
  62. data/spec/cassettes/machines/snapshots/index.yml +62 -0
  63. data/spec/cassettes/machines/snapshots/show.yml +62 -0
  64. data/spec/cassettes/machines/snapshots/start.yml +58 -0
  65. data/spec/cassettes/machines/start.yml +58 -0
  66. data/spec/cassettes/machines/stop.yml +58 -0
  67. data/spec/cassettes/machines/tags/create.yml +64 -0
  68. data/spec/cassettes/machines/tags/destroy.yml +56 -0
  69. data/spec/cassettes/machines/tags/index.yml +62 -0
  70. data/spec/cassettes/machines/tags/show.yml +62 -0
  71. data/spec/cassettes/packages/index.yml +123 -0
  72. data/spec/cassettes/packages/show.yml +63 -0
  73. data/spec/fixtures/config/sdccfg +4 -0
  74. data/spec/fixtures/ssh/id_rsa +27 -0
  75. data/spec/fixtures/ssh/id_rsa.pub +1 -0
  76. data/spec/smartdc/api/analytics_spec.rb +47 -0
  77. data/spec/smartdc/api/datacenters_spec.rb +19 -0
  78. data/spec/smartdc/api/images_spec.rb +19 -0
  79. data/spec/smartdc/api/keys_spec.rb +34 -0
  80. data/spec/smartdc/api/machines/metadata_spec.rb +27 -0
  81. data/spec/smartdc/api/machines/snapshots_spec.rb +38 -0
  82. data/spec/smartdc/api/machines/tags_spec.rb +33 -0
  83. data/spec/smartdc/api/machines_spec.rb +59 -0
  84. data/spec/smartdc/api/packages_spec.rb +19 -0
  85. data/spec/smartdc/auth_spec.rb +25 -0
  86. data/spec/smartdc/cli_configure_spec.rb +32 -0
  87. data/spec/smartdc/client_spec.rb +11 -0
  88. data/spec/smartdc_spec.rb +44 -0
  89. data/spec/spec_helper.rb +25 -8
  90. metadata +176 -83
  91. data/lib/cli_helper.rb +0 -126
  92. data/lib/configure.rb +0 -125
  93. data/lib/smartdc/api/datasets.rb +0 -20
  94. data/lib/smartdc/api/machine/metadata.rb +0 -24
  95. data/lib/smartdc/api/machine/snapshots.rb +0 -35
  96. data/lib/smartdc/api/machine/tags.rb +0 -29
  97. data/lib/smartdc/error.rb +0 -35
  98. data/lib/smartdc/request.rb +0 -83
  99. data/lib/smartdc/response.rb +0 -25
  100. data/lib/smartdc/response/raise_error.rb +0 -38
  101. data/spec/fixtures/analytics.json +0 -26
  102. data/spec/fixtures/datacenter.json +0 -4
  103. data/spec/fixtures/datacenters.json +0 -3
  104. data/spec/fixtures/datasets.json +0 -38
  105. data/spec/fixtures/keys.json +0 -14
  106. data/spec/fixtures/machines.json +0 -36
  107. data/spec/fixtures/packages.json +0 -18
  108. data/spec/fixtures/snapshots.json +0 -8
  109. data/spec/fixtures/tag.json +0 -3
  110. data/spec/unit/smartdc/api/analytics_spec.rb +0 -48
  111. data/spec/unit/smartdc/api/datacenters_spec.rb +0 -28
  112. data/spec/unit/smartdc/api/datasets_spec.rb +0 -28
  113. data/spec/unit/smartdc/api/keys_spec.rb +0 -48
  114. data/spec/unit/smartdc/api/machine/metadata_spec.rb +0 -38
  115. data/spec/unit/smartdc/api/machine/snapshots_spec.rb +0 -48
  116. data/spec/unit/smartdc/api/machine/tags_spec.rb +0 -48
  117. data/spec/unit/smartdc/api/machines_spec.rb +0 -48
  118. data/spec/unit/smartdc/api/packages_spec.rb +0 -28
  119. data/spec/unit/smartdc/client_spec.rb +0 -40
  120. 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
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Smartdc do
4
- describe ".new" do
5
- it "is a Smartdc::Client" do
6
- expect(Smartdc.new).to be_a Smartdc::Client
7
- end
8
- end
9
- end