civo 1.5.2 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/civo/database.rb +83 -9
- data/app/models/civo/load_balancer.rb +61 -5
- data/app/models/civo/team.rb +0 -5
- data/app/models/civo/team_member.rb +17 -0
- data/app/models/civo/user.rb +1 -1
- data/lib/civo/version.rb +1 -1
- data/lib/civo.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2fa0b7f96a69c9f894b72d57311784aebe4a39454f53559e83938136c8a8446
|
4
|
+
data.tar.gz: ec9c804f8ebfaa8a01544297b5d94b3a219d84b4a1d95dc16ad41ff59bbcf1d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af5814fc7c2493d0eeed660f42c723184ad4ee92bfe966e22745cd9864a550d955f96ee57e54ef9cedf7bcd4ef02b0785b2c9ce2cb330ec08b95b3dd60f7e017
|
7
|
+
data.tar.gz: 3a2bef74d8a074302fb047bd1dab7d4f0e57625196cb3611eed1247020c5d0b2d6039a6bcc983dbf7f083c795bfea7ecb9d3605b7b4ae28b2eb942aa0b5e7e07
|
data/app/models/civo/database.rb
CHANGED
@@ -1,17 +1,91 @@
|
|
1
1
|
module Civo
|
2
2
|
class Database < Base
|
3
|
-
get :all, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases"
|
4
|
-
post :create, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases", requires: [:name, :size, :region]
|
5
|
-
get :find, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id"
|
6
|
-
|
7
|
-
delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:id]
|
8
|
-
|
9
|
-
put :restore, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/restore", requires: [:snapshot_id]
|
10
|
-
get :snapshots, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/snapshots"
|
11
|
-
put :tags, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/tags"
|
3
|
+
get :all, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases", requires: [:region], fake: :databases
|
4
|
+
post :create, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases", requires: [:name, :size, :region, :software, :network_id], fake: :create_database
|
5
|
+
get :find, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:region], fake: :get_database
|
6
|
+
patch :update, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:region], fake: :update_database
|
7
|
+
delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:id, :region], fake: :delete_database
|
8
|
+
post :restore, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/restore", requires: [:region, :snapshot_id], fake: :restore_database
|
12
9
|
|
13
10
|
def to_partial_path
|
14
11
|
"civo/database"
|
15
12
|
end
|
13
|
+
|
14
|
+
def databases
|
15
|
+
[
|
16
|
+
{
|
17
|
+
"id": "5cc0696d-6663-48a9-8123-87adb997138c",
|
18
|
+
"name": "Mysite-DB",
|
19
|
+
"replicas": 2,
|
20
|
+
"size": 10,
|
21
|
+
"software": "PostgreSQL",
|
22
|
+
"software_version": "10.1",
|
23
|
+
"public_ip": "84.127.44.100",
|
24
|
+
"network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
|
25
|
+
"snapshots": [
|
26
|
+
{
|
27
|
+
"id": "5cc0696d-6663-48a9-8123-87adb997138c",
|
28
|
+
"timestamp": "2021-12-04T10:00:28Z"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
}
|
32
|
+
].to_json
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_database
|
36
|
+
{
|
37
|
+
"id": "5cc0696d-6663-48a9-8123-87adb997138c",
|
38
|
+
"name": "Mysite-DB",
|
39
|
+
"replicas": 2,
|
40
|
+
"size": 10,
|
41
|
+
"software": "PostgreSQL",
|
42
|
+
"software_version": "10.1",
|
43
|
+
"public_ip": "84.127.44.100",
|
44
|
+
"network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
|
45
|
+
"snapshots": [
|
46
|
+
{
|
47
|
+
"id": "5cc0696d-6663-48a9-8123-87adb997138c",
|
48
|
+
"timestamp": "2021-12-04T10:00:28Z"
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}.to_json
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_database
|
55
|
+
{
|
56
|
+
"id": "5cc0696d-6663-48a9-8123-87adb997138c",
|
57
|
+
"name": "Mysite-DB",
|
58
|
+
"replicas": 2,
|
59
|
+
"size": 10,
|
60
|
+
"software": "PostgreSQL",
|
61
|
+
"software_version": "10.1",
|
62
|
+
"public_ip": "84.127.44.100",
|
63
|
+
"network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
|
64
|
+
"snapshots": []
|
65
|
+
}.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
def update_database
|
69
|
+
{
|
70
|
+
"id": "5cc0696d-6663-48a9-8123-87adb997138c",
|
71
|
+
"name": "Mysite-DB-renamed",
|
72
|
+
"replicas": 3,
|
73
|
+
"size": 10,
|
74
|
+
"software": "PostgreSQL",
|
75
|
+
"software_version": "10.1",
|
76
|
+
"public_ip": "84.127.44.100",
|
77
|
+
"network_id": "5be0646d-6e63-4aa9-8123-87adb447138c",
|
78
|
+
"snapshots": []
|
79
|
+
}.to_json
|
80
|
+
end
|
81
|
+
|
82
|
+
def restore_database
|
83
|
+
{ result: "OK" }.to_json
|
84
|
+
end
|
85
|
+
|
86
|
+
def delete_database
|
87
|
+
{ result: "OK" }.to_json
|
88
|
+
end
|
89
|
+
|
16
90
|
end
|
17
91
|
end
|
@@ -1,13 +1,69 @@
|
|
1
1
|
module Civo
|
2
2
|
class LoadBalancer < Base
|
3
|
-
get :all, "/v2/loadbalancers"
|
4
|
-
get :find, "/v2/loadbalancers/:id"
|
5
|
-
post :create, "/v2/loadbalancers", required: [:hostname]
|
6
|
-
put :update, "/v2/loadbalancers/:id"
|
7
|
-
delete :remove, "/v2/loadbalancers/:id", required: [:id]
|
3
|
+
get :all, "/v2/loadbalancers", fake: :loadbalancers
|
4
|
+
get :find, "/v2/loadbalancers/:id", fake: :get_loadbalancer
|
5
|
+
post :create, "/v2/loadbalancers", required: [:hostname], fake: :get_loadbalancer
|
6
|
+
put :update, "/v2/loadbalancers/:id", fake: :get_loadbalancer
|
7
|
+
delete :remove, "/v2/loadbalancers/:id", required: [:id], fake: :delete_loadbalancer
|
8
8
|
|
9
9
|
def to_partial_path
|
10
10
|
"civo/loadbalancer"
|
11
11
|
end
|
12
|
+
|
13
|
+
def loadbalancers
|
14
|
+
[
|
15
|
+
{
|
16
|
+
id: 23,
|
17
|
+
name: "Johnny",
|
18
|
+
algorithm: "round_robin",
|
19
|
+
state: "available",
|
20
|
+
public_ipv4: "192.168.1.10",
|
21
|
+
private_ipv4: "10.10.10.10",
|
22
|
+
firewall_id: "86E2749F-8FA1-4D49-8833-299D02E585B8",
|
23
|
+
cluster_id: "96E2749F-8FA1-4D49-8833-299D02E585B8"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
id: 223,
|
27
|
+
name: "Dep",
|
28
|
+
algorithm: "weighted_fixed",
|
29
|
+
state: "available",
|
30
|
+
public_ipv4: "192.168.1.30",
|
31
|
+
private_ipv4: "10.10.10.12",
|
32
|
+
firewall_id: "36E2749F-8FA1-4D49-8833-299D02E585B8",
|
33
|
+
cluster_id: "46E2749F-8FA1-4D49-8833-299D02E585B8"
|
34
|
+
}
|
35
|
+
].to_json
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_loadbalancer
|
39
|
+
{
|
40
|
+
id: 23,
|
41
|
+
name: "Johnny",
|
42
|
+
algorithm: "round_robin",
|
43
|
+
state: "available",
|
44
|
+
public_ipv4: "192.168.1.10",
|
45
|
+
private_ipv4: "10.10.10.10",
|
46
|
+
firewall_id: "86E2749F-8FA1-4D49-8833-299D02E585B8",
|
47
|
+
cluster_id: "96E2749F-8FA1-4D49-8833-299D02E585B8",
|
48
|
+
endpoints: [
|
49
|
+
{
|
50
|
+
ip: "192.168.1.4",
|
51
|
+
protocol: "TCP",
|
52
|
+
source_port: 80,
|
53
|
+
target_port: 31579
|
54
|
+
},
|
55
|
+
{
|
56
|
+
ip: "192.168.1.5",
|
57
|
+
protocol: "TCP",
|
58
|
+
source_port: 80,
|
59
|
+
target_port: 31579
|
60
|
+
}
|
61
|
+
]
|
62
|
+
}.to_json
|
63
|
+
end
|
64
|
+
|
65
|
+
def delete_loadbalancer
|
66
|
+
{ result: "Success" }.to_json
|
67
|
+
end
|
12
68
|
end
|
13
69
|
end
|
data/app/models/civo/team.rb
CHANGED
@@ -8,10 +8,5 @@ module Civo
|
|
8
8
|
post :create, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams"
|
9
9
|
put :update, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id", requires: %i{id}
|
10
10
|
delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id", requires: %i{id}
|
11
|
-
|
12
|
-
get :members, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members"
|
13
|
-
post :add_member, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members", requires: [:user_id]
|
14
|
-
put :update_member, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members/:member_id"
|
15
|
-
delete :remove_member, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members/:member_id"
|
16
11
|
end
|
17
12
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# WARNING!
|
2
|
+
# This module is for an in-development feature of Civo and isn't intended to
|
3
|
+
# be used by the general public yet. Public accounts won't even have the
|
4
|
+
# feature flag enabled. Do not bother trying to use this class.
|
5
|
+
module Civo
|
6
|
+
class TeamMember < Base
|
7
|
+
get :all, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members"
|
8
|
+
post :add, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members", requires: [:user_id]
|
9
|
+
put :update, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members/:member_id"
|
10
|
+
delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/teams/:id/members/:member_id"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
data/app/models/civo/user.rb
CHANGED
@@ -9,7 +9,7 @@ module Civo
|
|
9
9
|
put :flags, "/v#{ENV["CIVO_API_VERSION"] || "2"}/users/:id/flags"
|
10
10
|
put :save, "/v#{ENV["CIVO_API_VERSION"] || "2"}/users/:id"
|
11
11
|
get :find, "/v#{ENV["CIVO_API_VERSION"] || "2"}/users/:id"
|
12
|
-
get :everything, "/v#{ENV["CIVO_API_VERSION"] || "2"}/users/:id/everything"
|
12
|
+
get :everything, "/v#{ENV["CIVO_API_VERSION"] || "2"}/users/:id/everything", has_many: {accounts: Civo::Account, teams: Civo::Team, organisations: Civo::Organisation, roles: Civo::Role, team_members: Civo::TeamMember}
|
13
13
|
if ENV["CIVO_API_VERSION"] == "2"
|
14
14
|
get :all, "/v2/users"
|
15
15
|
get :find_by_token, "/v2/users/token/:token"
|
data/lib/civo/version.rb
CHANGED
data/lib/civo.rb
CHANGED
@@ -26,13 +26,16 @@ require_relative "../app/models/civo/ip"
|
|
26
26
|
require_relative "../app/models/civo/kpi"
|
27
27
|
require_relative "../app/models/civo/load_balancer"
|
28
28
|
require_relative "../app/models/civo/network"
|
29
|
+
require_relative "../app/models/civo/organisation"
|
29
30
|
require_relative "../app/models/civo/quota"
|
30
31
|
require_relative "../app/models/civo/region"
|
32
|
+
require_relative "../app/models/civo/role"
|
31
33
|
require_relative "../app/models/civo/size"
|
32
34
|
require_relative "../app/models/civo/snapshot"
|
33
35
|
require_relative "../app/models/civo/ssh_key"
|
34
36
|
require_relative "../app/models/civo/system"
|
35
37
|
require_relative "../app/models/civo/team"
|
38
|
+
require_relative "../app/models/civo/team_member"
|
36
39
|
require_relative "../app/models/civo/template"
|
37
40
|
require_relative "../app/models/civo/user"
|
38
41
|
require_relative "../app/models/civo/volume"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: civo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flexirest
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- app/models/civo/ssh_key.rb
|
104
104
|
- app/models/civo/system.rb
|
105
105
|
- app/models/civo/team.rb
|
106
|
+
- app/models/civo/team_member.rb
|
106
107
|
- app/models/civo/template.rb
|
107
108
|
- app/models/civo/user.rb
|
108
109
|
- app/models/civo/volume.rb
|