latitude-api 0.2.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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +10 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +283 -0
  5. data/Rakefile +13 -0
  6. data/lib/latitude/api/api_object.rb +105 -0
  7. data/lib/latitude/api/api_resource.rb +260 -0
  8. data/lib/latitude/api/attributes.rb +64 -0
  9. data/lib/latitude/api/client.rb +80 -0
  10. data/lib/latitude/api/configuration.rb +88 -0
  11. data/lib/latitude/api/errors.rb +134 -0
  12. data/lib/latitude/api/json_api.rb +40 -0
  13. data/lib/latitude/api/list_object.rb +129 -0
  14. data/lib/latitude/api/objects.rb +216 -0
  15. data/lib/latitude/api/operations/action.rb +41 -0
  16. data/lib/latitude/api/operations/create.rb +22 -0
  17. data/lib/latitude/api/operations/delete.rb +22 -0
  18. data/lib/latitude/api/operations/list.rb +54 -0
  19. data/lib/latitude/api/operations/nested.rb +53 -0
  20. data/lib/latitude/api/operations/retrieve.rb +22 -0
  21. data/lib/latitude/api/operations/update.rb +22 -0
  22. data/lib/latitude/api/request_executor.rb +217 -0
  23. data/lib/latitude/api/request_options.rb +86 -0
  24. data/lib/latitude/api/request_params.rb +70 -0
  25. data/lib/latitude/api/resources/api_key.rb +61 -0
  26. data/lib/latitude/api/resources/billing_usage.rb +51 -0
  27. data/lib/latitude/api/resources/elastic_ip.rb +96 -0
  28. data/lib/latitude/api/resources/event.rb +55 -0
  29. data/lib/latitude/api/resources/firewall.rb +129 -0
  30. data/lib/latitude/api/resources/ip.rb +110 -0
  31. data/lib/latitude/api/resources/kubernetes_cluster.rb +184 -0
  32. data/lib/latitude/api/resources/plan.rb +658 -0
  33. data/lib/latitude/api/resources/project.rb +179 -0
  34. data/lib/latitude/api/resources/region.rb +41 -0
  35. data/lib/latitude/api/resources/role.rb +20 -0
  36. data/lib/latitude/api/resources/server.rb +251 -0
  37. data/lib/latitude/api/resources/ssh_key.rb +44 -0
  38. data/lib/latitude/api/resources/storage_filesystem.rb +36 -0
  39. data/lib/latitude/api/resources/storage_object.rb +85 -0
  40. data/lib/latitude/api/resources/storage_volume.rb +64 -0
  41. data/lib/latitude/api/resources/tag.rb +34 -0
  42. data/lib/latitude/api/resources/team.rb +169 -0
  43. data/lib/latitude/api/resources/traffic.rb +215 -0
  44. data/lib/latitude/api/resources/user_data.rb +38 -0
  45. data/lib/latitude/api/resources/user_profile.rb +51 -0
  46. data/lib/latitude/api/resources/user_team.rb +90 -0
  47. data/lib/latitude/api/resources/virtual_machine.rb +146 -0
  48. data/lib/latitude/api/resources/virtual_network.rb +162 -0
  49. data/lib/latitude/api/resources/vpn_session.rb +80 -0
  50. data/lib/latitude/api/singleton_api_resource.rb +22 -0
  51. data/lib/latitude/api/util.rb +64 -0
  52. data/lib/latitude/api/version.rb +7 -0
  53. data/lib/latitude/api.rb +147 -0
  54. data/lib/latitude/metadata/errors.rb +18 -0
  55. data/lib/latitude/metadata/session.rb +109 -0
  56. data/lib/latitude/metadata.rb +43 -0
  57. data/lib/latitude.rb +4 -0
  58. metadata +132 -0
@@ -0,0 +1,184 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Latitude
4
+ module API
5
+ module Resources
6
+ # @!attribute [rw] name
7
+ # @return [String]
8
+ # @!attribute [rw] phase
9
+ # @return [String]
10
+ # @!attribute [rw] ready
11
+ # @return [Boolean]
12
+ # @!attribute [rw] control_plane_endpoint
13
+ # @return [String]
14
+ # @!attribute [rw] kubeconfig_url
15
+ # @return [String]
16
+ # @!attribute [rw] location
17
+ # @return [String]
18
+ # @!attribute [rw] load_balancer_ips
19
+ # @return [Array]
20
+ # @!attribute [rw] kubernetes_version
21
+ # @return [String]
22
+ # @!attribute [rw] version_status
23
+ # @return [String]
24
+ # @!attribute [rw] available_upgrade
25
+ # @return [String]
26
+ # @!attribute [r] created_at
27
+ # @return [Time]
28
+ # @!attribute [rw] plan
29
+ # @return [String]
30
+ # @!attribute [rw] worker_plan
31
+ # @return [String]
32
+ # @!attribute [rw] control_plane_count
33
+ # @return [Integer]
34
+ # @!attribute [rw] worker_count
35
+ # @return [Integer]
36
+ # @!attribute [rw] control_plane
37
+ # @return [ControlPlane]
38
+ # @!attribute [rw] workers
39
+ # @return [Worker]
40
+ # @!attribute [rw] worker_status
41
+ # @return [String]
42
+ # @!attribute [rw] control_plane_status
43
+ # @return [String]
44
+ # @!attribute [rw] infrastructure_ready
45
+ # @return [Boolean]
46
+ # @!attribute [rw] control_plane_ready
47
+ # @return [Boolean]
48
+ # @!attribute [rw] message
49
+ # @return [String]
50
+ # @!attribute [rw] steps
51
+ # @return [Array<Step>]
52
+ # @!attribute [rw] last_status_change
53
+ # @return [Time]
54
+ # @!attribute [rw] failure_message
55
+ # @return [String]
56
+ # @!attribute [rw] failure_reason
57
+ # @return [String]
58
+ # @!attribute [rw] nodes
59
+ # @return [Array<Node>]
60
+ # @!attribute [rw] project
61
+ # @return [Latitude::API::Objects::Project]
62
+ # @!attribute [rw] status
63
+ # @return [String]
64
+ class KubernetesCluster < APIResource
65
+ # @!attribute [r] ready
66
+ # @return [Boolean]
67
+ # @!attribute [r] replicas
68
+ # @return [Integer]
69
+ # @!attribute [r] ready_replicas
70
+ # @return [Integer]
71
+ class ControlPlane < APIObject
72
+ attribute :ready, :boolean, read_only: true
73
+ attribute :replicas, :integer, read_only: true
74
+ attribute :ready_replicas, :integer, read_only: true
75
+ end
76
+
77
+ # @!attribute [r] replicas
78
+ # @return [Integer]
79
+ # @!attribute [r] ready_replicas
80
+ # @return [Integer]
81
+ # @!attribute [r] available_replicas
82
+ # @return [Integer]
83
+ class Worker < APIObject
84
+ attribute :replicas, :integer, read_only: true
85
+ attribute :ready_replicas, :integer, read_only: true
86
+ attribute :available_replicas, :integer, read_only: true
87
+ end
88
+
89
+ # @!attribute [r] name
90
+ # @return [String]
91
+ # @!attribute [r] status
92
+ # @return [String]
93
+ class Step < APIObject
94
+ attribute :name, :string, read_only: true
95
+ attribute :status, :string, read_only: true
96
+ end
97
+
98
+ # @!attribute [r] id
99
+ # @return [String]
100
+ # @!attribute [r] name
101
+ # @return [String]
102
+ # @!attribute [r] hostname
103
+ # @return [String]
104
+ # @!attribute [r] server_id
105
+ # @return [String]
106
+ # @!attribute [r] type
107
+ # @return [String]
108
+ # @!attribute [r] status
109
+ # @return [String]
110
+ # @!attribute [r] ip
111
+ # @return [String]
112
+ # @!attribute [r] internal_ip
113
+ # @return [String]
114
+ # @!attribute [r] external_ip
115
+ # @return [String]
116
+ class Node < APIObject
117
+ attribute :id, :string, read_only: true
118
+ attribute :name, :string, read_only: true
119
+ attribute :hostname, :string, read_only: true
120
+ attribute :server_id, :string, read_only: true
121
+ attribute :type, :string, read_only: true
122
+ attribute :status, :string, read_only: true
123
+ attribute :ip, :string, read_only: true
124
+ attribute :internal_ip, :string, read_only: true
125
+ attribute :external_ip, :string, read_only: true
126
+ end
127
+
128
+ attribute :name, :string
129
+ attribute :phase, :string
130
+ attribute :ready, :boolean
131
+ attribute :control_plane_endpoint, :string
132
+ attribute :kubeconfig_url, :string
133
+ attribute :location, :string
134
+ attribute :load_balancer_ips, :array
135
+ attribute :kubernetes_version, :string
136
+ attribute :version_status, :string
137
+ attribute :available_upgrade, :string
138
+ attribute :created_at, :time, read_only: true
139
+ attribute :plan, :string
140
+ attribute :worker_plan, :string
141
+ attribute :control_plane_count, :integer
142
+ attribute :worker_count, :integer
143
+ attribute :control_plane, ControlPlane
144
+ attribute :workers, Worker
145
+ attribute :worker_status, :string
146
+ attribute :control_plane_status, :string
147
+ attribute :infrastructure_ready, :boolean
148
+ attribute :control_plane_ready, :boolean
149
+ attribute :message, :string
150
+ attribute :steps, [Step]
151
+ attribute :last_status_change, :time
152
+ attribute :failure_message, :string
153
+ attribute :failure_reason, :string
154
+ attribute :nodes, [Node]
155
+ attribute :project, Objects::Project
156
+ attribute :status, :string
157
+
158
+ resource_type "kubernetes_clusters"
159
+ resource_path "/kubernetes_clusters"
160
+ id_prefix "kc_"
161
+
162
+ extend Operations::List
163
+ extend Operations::Create
164
+ extend Operations::Retrieve
165
+ extend Operations::Update
166
+ extend Operations::Delete
167
+
168
+ class << self
169
+ def available_versions(opts = {})
170
+ execute_request(method: :get, path: "#{resource_path}/available_versions", opts: opts)
171
+ end
172
+
173
+ def kubeconfig(id, opts = {})
174
+ execute_request(method: :get, path: "#{instance_url(id)}/kubeconfig", opts: opts)
175
+ end
176
+ end
177
+
178
+ def kubeconfig(opts = {})
179
+ self.class.kubeconfig(id, opts)
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end