fog-cloudatcost 0.2.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +21 -35
- data/.rubocop.yml +10 -1157
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -25
- data/Gemfile +2 -0
- data/README.md +0 -1
- data/Rakefile +6 -18
- data/fog-cloudatcost.gemspec +24 -23
- data/lib/fog/cloudatcost.rb +13 -1
- data/lib/fog/cloudatcost/compute.rb +20 -18
- data/lib/fog/cloudatcost/models/server.rb +6 -6
- data/lib/fog/cloudatcost/models/servers.rb +4 -2
- data/lib/fog/cloudatcost/models/task.rb +2 -0
- data/lib/fog/cloudatcost/models/tasks.rb +4 -2
- data/lib/fog/cloudatcost/models/template.rb +2 -0
- data/lib/fog/cloudatcost/models/templates.rb +4 -2
- data/lib/fog/cloudatcost/requests/console.rb +16 -11
- data/lib/fog/cloudatcost/requests/create_server.rb +13 -11
- data/lib/fog/cloudatcost/requests/delete_server.rb +13 -11
- data/lib/fog/cloudatcost/requests/list_servers.rb +7 -5
- data/lib/fog/cloudatcost/requests/list_tasks.rb +7 -5
- data/lib/fog/cloudatcost/requests/list_templates.rb +7 -5
- data/lib/fog/cloudatcost/requests/power_off.rb +14 -12
- data/lib/fog/cloudatcost/requests/power_on.rb +14 -12
- data/lib/fog/cloudatcost/requests/rename_server.rb +16 -14
- data/lib/fog/cloudatcost/requests/reset.rb +14 -12
- data/lib/fog/cloudatcost/requests/reverse_dns.rb +13 -11
- data/lib/fog/cloudatcost/requests/run_mode.rb +13 -11
- data/lib/fog/cloudatcost/version.rb +3 -1
- data/spec/fog/models/server_spec.rb +5 -4
- data/spec/fog/models/servers_spec.rb +3 -3
- data/spec/fog/models/task_spec.rb +3 -2
- data/spec/fog/models/tasks_spec.rb +3 -3
- data/spec/fog/models/template_spec.rb +3 -2
- data/spec/fog/models/templates_spec.rb +3 -3
- data/spec/spec_helper.rb +9 -4
- metadata +57 -47
- data/.codeclimate.yml +0 -28
- data/Gemfile.lock +0 -71
- data/lib/fog/cloudatcost/core.rb +0 -9
- data/spec/model_setup.rb +0 -14
@@ -1,29 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def delete_server(id)
|
6
|
-
body = { sid:
|
8
|
+
body = { sid: id.to_s }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/cloudpro/delete.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def delete_server(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
19
|
+
def delete_server(_id)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
21
23
|
'result' => 'successful',
|
22
24
|
'api' => 'v1',
|
23
25
|
'action' => 'delete',
|
24
26
|
'status' => 'ok',
|
25
|
-
'taskid' =>
|
26
|
-
'time' =>
|
27
|
+
'taskid' => 123_123_123_123,
|
28
|
+
'time' => 12_312_323
|
27
29
|
}
|
28
30
|
response
|
29
31
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def list_servers
|
6
8
|
request(
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
9
|
+
expects: [200],
|
10
|
+
method: 'GET',
|
11
|
+
path: '/api/v1/listservers.php'
|
10
12
|
)
|
11
13
|
end
|
12
14
|
end
|
@@ -17,8 +19,8 @@ module Fog
|
|
17
19
|
response = Excon::Response.new
|
18
20
|
response.status = 200
|
19
21
|
response.body = {
|
20
|
-
|
21
|
-
|
22
|
+
'status' => 'OK',
|
23
|
+
'servers' => data[:data]
|
22
24
|
}
|
23
25
|
response
|
24
26
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def list_tasks
|
6
8
|
request(
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
9
|
+
expects: [200],
|
10
|
+
method: 'GET',
|
11
|
+
path: '/api/v1/listtasks.php'
|
10
12
|
)
|
11
13
|
end
|
12
14
|
end
|
@@ -17,8 +19,8 @@ module Fog
|
|
17
19
|
response = Excon::Response.new
|
18
20
|
response.status = 200
|
19
21
|
response.body = {
|
20
|
-
|
21
|
-
|
22
|
+
'status' => 'OK',
|
23
|
+
'servers' => data[:data]
|
22
24
|
}
|
23
25
|
response
|
24
26
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def list_templates
|
6
8
|
request(
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
9
|
+
expects: [200],
|
10
|
+
method: 'GET',
|
11
|
+
path: '/api/v1/listtemplates.php'
|
10
12
|
)
|
11
13
|
end
|
12
14
|
end
|
@@ -17,8 +19,8 @@ module Fog
|
|
17
19
|
response = Excon::Response.new
|
18
20
|
response.status = 200
|
19
21
|
response.body = {
|
20
|
-
|
21
|
-
|
22
|
+
'status' => 'OK',
|
23
|
+
'servers' => data[:data]
|
22
24
|
}
|
23
25
|
response
|
24
26
|
end
|
@@ -1,30 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def power_off(id)
|
6
|
-
body = { :
|
8
|
+
body = { sid: id.to_s, action: 'poweroff' }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/powerop.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def power_off(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
21
|
-
'server_id'
|
19
|
+
def power_off(_id)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
'server_id' => Fog::Mock.random_numbers(1).to_i,
|
22
24
|
'api' => 'v1',
|
23
25
|
'status' => 'ok',
|
24
26
|
'result' => 'successful',
|
25
27
|
'action' => 'poweroff',
|
26
|
-
'time' =>
|
27
|
-
'taskid' =>
|
28
|
+
'time' => 12_312_323,
|
29
|
+
'taskid' => 123_123_123_123
|
28
30
|
}
|
29
31
|
response
|
30
32
|
end
|
@@ -1,30 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def power_on(id)
|
6
|
-
body = { :
|
8
|
+
body = { sid: id.to_s, action: 'poweron' }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/powerop.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def power_on(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
21
|
-
'server_id'
|
19
|
+
def power_on(_id)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
'server_id' => Fog::Mock.random_numbers(1).to_i,
|
22
24
|
'api' => 'v1',
|
23
25
|
'status' => 'ok',
|
24
26
|
'result' => 'successful',
|
25
27
|
'action' => 'poweron',
|
26
|
-
'time' =>
|
27
|
-
'taskid' =>
|
28
|
+
'time' => 12_312_323,
|
29
|
+
'taskid' => 123_123_123_123
|
28
30
|
}
|
29
31
|
response
|
30
32
|
end
|
@@ -1,28 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def rename_server(id, name)
|
6
|
-
body = { :
|
8
|
+
body = { sid: id.to_s, name: name.to_s }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/renameserver.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def rename_server(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
21
|
-
'server_id'
|
22
|
-
'api' =>
|
23
|
-
'status' =>
|
24
|
-
'result' =>
|
25
|
-
'time' =>
|
19
|
+
def rename_server(_id, _name)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
'server_id' => Fog::Mock.random_numbers(1).to_i,
|
24
|
+
'api' => 'v1',
|
25
|
+
'status' => 'ok',
|
26
|
+
'result' => 'successful',
|
27
|
+
'time' => 12_312_323
|
26
28
|
}
|
27
29
|
response
|
28
30
|
end
|
@@ -1,30 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def reset(id)
|
6
|
-
body = { :
|
8
|
+
body = { sid: id.to_s, action: 'reset' }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/powerop.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def reset(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
21
|
-
'server_id'
|
19
|
+
def reset(_id)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
'server_id' => Fog::Mock.random_numbers(1).to_i,
|
22
24
|
'api' => 'v1',
|
23
25
|
'status' => 'ok',
|
24
26
|
'result' => 'successful',
|
25
27
|
'action' => 'reset',
|
26
|
-
'time' =>
|
27
|
-
'taskid' =>
|
28
|
+
'time' => 12_312_323,
|
29
|
+
'taskid' => 123_123_123_123
|
28
30
|
}
|
29
31
|
response
|
30
32
|
end
|
@@ -1,28 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def reverse_dns(id, host_name)
|
6
|
-
body = { :
|
8
|
+
body = { sid: id.to_s, hostname: host_name.to_s }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/rdns.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def reverse_dns(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
21
|
-
'server_id'
|
19
|
+
def reverse_dns(_id, _hostname)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
'server_id' => Fog::Mock.random_numbers(1).to_i,
|
22
24
|
'api' => 'v1',
|
23
25
|
'status' => 'ok',
|
24
26
|
'result' => 'successful',
|
25
|
-
'time' =>
|
27
|
+
'time' => 12_312_323
|
26
28
|
}
|
27
29
|
response
|
28
30
|
end
|
@@ -1,28 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Fog
|
2
4
|
module Compute
|
3
5
|
class CloudAtCost
|
4
6
|
class Real
|
5
7
|
def run_mode(id, action)
|
6
|
-
body = { :
|
8
|
+
body = { sid: id.to_s, mode: action.to_s }
|
7
9
|
request(
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
10
|
+
expects: [200],
|
11
|
+
method: 'POST',
|
12
|
+
path: 'api/v1/runmode.php',
|
13
|
+
body: body
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
class Mock
|
17
|
-
def run_mode(
|
18
|
-
response
|
19
|
-
response.status
|
20
|
-
response.body
|
21
|
-
'server_id'
|
19
|
+
def run_mode(_id, _action)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
'server_id' => Fog::Mock.random_numbers(1).to_i,
|
22
24
|
'api' => 'v1',
|
23
25
|
'status' => 'ok',
|
24
26
|
'result' => 'successful',
|
25
|
-
'time' =>
|
27
|
+
'time' => 12_312_323
|
26
28
|
}
|
27
29
|
response
|
28
30
|
end
|
@@ -1,14 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
|
-
require 'fog/cloudatcost/models/server'
|
3
4
|
|
4
|
-
describe Fog::Compute::CloudAtCost::Server do
|
5
|
+
RSpec.describe Fog::Compute::CloudAtCost::Server do
|
5
6
|
let(:server) { Fog::Compute::CloudAtCost::Server.new }
|
6
7
|
|
7
|
-
server_attributes = %w
|
8
|
+
server_attributes = %w[sid id CustID packageid label servername
|
8
9
|
vmname ip netmask gateway hostname rootpass
|
9
10
|
vncport vncpass servertype template cpu cpuusage
|
10
11
|
ram ramusage storage hdusage sdate status panel_note
|
11
|
-
mode uid rdns rdnsdefault template_id
|
12
|
+
mode uid rdns rdnsdefault template_id]
|
12
13
|
|
13
14
|
it 'tests attributes' do
|
14
15
|
server_attributes.each do |attribute|
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
|
-
require 'fog/cloudatcost/models/servers'
|
3
4
|
|
4
|
-
describe Fog::Compute::CloudAtCost::Servers do
|
5
|
+
RSpec.describe Fog::Compute::CloudAtCost::Servers do
|
5
6
|
subject { Fog::Compute::CloudAtCost::Servers }
|
6
7
|
|
7
8
|
it 'should have a collection of servers' do
|
8
9
|
expect(subject.model).to eq(Fog::Compute::CloudAtCost::Server)
|
9
10
|
end
|
10
11
|
end
|
11
|
-
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
|
-
require 'fog/cloudatcost/models/task'
|
3
4
|
|
4
|
-
describe Fog::Compute::CloudAtCost::Task do
|
5
|
+
RSpec.describe Fog::Compute::CloudAtCost::Task do
|
5
6
|
let(:server) { Fog::Compute::CloudAtCost::Task.new }
|
6
7
|
|
7
8
|
it 'respond to #id' do
|