civo 1.5.3 → 1.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb8656e6a68bc22cfe6f8d62036ef34c1ea9d0669ac9f06cf5d22cae11f1b54
4
- data.tar.gz: 34cdbe84bc7d540c83962aeb883abe326204591e019d0badcf7e2c4b19134fbf
3
+ metadata.gz: 4c721f8c01795679e286e9633bd0176afe250ca2852dbf7eb69ca1b7245f18ca
4
+ data.tar.gz: cd2bcd8f6f6967286e3e48f3d08342126b5e0bbcfcc53a633013744958707625
5
5
  SHA512:
6
- metadata.gz: a083bd4de8b7dede1449d148db98b9d5e479f27f86512723ad48cb6aaf9006225659504e1690d5084351d752df9e39136c97575df4f4b35bfb06a81e365a9196
7
- data.tar.gz: 22ae869debf50e66f38f51c6c2e82b425105817d4feddb95a90c9a8775b6c946e8c1081b8cd94c1e80bcdbd871f429467a8130be3c2618d51c026776c112d4a9
6
+ metadata.gz: 761951fb942c5fac01c590859399697b63c484bbc1fed552a9ebc8d23c27429d03121b071762b0756e3ea31d112787871ad0df61f550a0a4c0e01669b1b07f90
7
+ data.tar.gz: 49f87ae6c60c26db3fb13677ba8c887300e916bb096fc30bd9e38a31f811b7887dbbe1350c75a0c9dcadb20539da2630fdd1c7fce67ad23f260d85cd50539d01
@@ -9,6 +9,7 @@ module Civo
9
9
  put :save, "/v#{ENV["CIVO_API_VERSION"] || "2"}/accounts/:id"
10
10
  delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/accounts/:id", requires: [:id]
11
11
  get :active_paid_services, "/v#{ENV["CIVO_API_VERSION"] || "2"}/accounts/:id/active_paid_services", requires: [:id]
12
+ get :ids, "/v#{ENV["CIVO_API_VERSION"] || "2"}/accounts/ids"
12
13
 
13
14
  def to_partial_path
14
15
  "civo/account"
@@ -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
- put :update, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id"
7
- delete :remove, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id", requires: [:id]
8
- put :upgrade, "/v#{ENV["CIVO_API_VERSION"] || "2"}/databases/:id/resize", requires: [:size, :id]
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
@@ -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
+
@@ -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", has_many: {accounts: Civo::Account, teams: Civo::Team, organisations: Civo::Organisation, roles: Civo::Role}
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
@@ -1,3 +1,3 @@
1
1
  module Civo
2
- VERSION = "1.5.3"
2
+ VERSION = "1.5.7"
3
3
  end
data/lib/civo.rb CHANGED
@@ -35,6 +35,7 @@ require_relative "../app/models/civo/snapshot"
35
35
  require_relative "../app/models/civo/ssh_key"
36
36
  require_relative "../app/models/civo/system"
37
37
  require_relative "../app/models/civo/team"
38
+ require_relative "../app/models/civo/team_member"
38
39
  require_relative "../app/models/civo/template"
39
40
  require_relative "../app/models/civo/user"
40
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.3
4
+ version: 1.5.7
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-10-18 00:00:00.000000000 Z
11
+ date: 2021-12-13 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