civo 1.5.1 → 1.5.5

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: 5b5b254cffb9ee4a8357d5bf9f07fa2c05f6a0db4a82e391dd9df9d0ed7a3a0f
4
- data.tar.gz: 5d4515d16f051aa888ab3b162a9c53d9fd2b7c9a8c3c70af832288a778fff9b1
3
+ metadata.gz: 9ab48b29aaf69b2c3813afb09143b139774e0e55bc542243c5ca182fdaf7d707
4
+ data.tar.gz: 168d513969f901886fad9d64509d2f0c0b5b7ce1229973c8ac016765bb1a7f35
5
5
  SHA512:
6
- metadata.gz: f4ce5b7e14bc497801759497eca684c59c479b283abc0b7f599f6ce4c1aac8430a7ec483f886adf394842b17754c21bd64d4d4cff1874015772be8999c25b8e5
7
- data.tar.gz: 38c08c86e5195a9dfaa5824a05d9f5da04d965e1fddfd53981a998aef24737c9e3356536d854793a5a2ef51d450df2144966cd2b95f7726a84d9748660dd6d4a
6
+ metadata.gz: b9239f60e9060cfd1e2fed7bdd6140a005f3aa178e072abb62a6569cb585e6f553a1c4e9957311d5c4398497769af63c362d57d68d59d3890488ee133d8227c6
7
+ data.tar.gz: 6bf212e039c8a7daa86e9f2cc3f175088acc6af08099acc93f8854be2f170e1ed6b0340ec3caf07ad0784ed988f9dc8ab989a099c28bb3026ca7548d036d7134
@@ -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,55 @@
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
+ }.to_json
49
+ end
50
+
51
+ def delete_loadbalancer
52
+ { result: "Success" }.to_json
53
+ end
12
54
  end
13
55
  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,6 +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, team_members: Civo::TeamMember}
12
13
  if ENV["CIVO_API_VERSION"] == "2"
13
14
  get :all, "/v2/users"
14
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.1"
2
+ VERSION = "1.5.5"
3
3
  end
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.1
4
+ version: 1.5.5
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-08 00:00:00.000000000 Z
11
+ date: 2021-12-01 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