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.
- checksums.yaml +7 -0
- data/.yardopts +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +283 -0
- data/Rakefile +13 -0
- data/lib/latitude/api/api_object.rb +105 -0
- data/lib/latitude/api/api_resource.rb +260 -0
- data/lib/latitude/api/attributes.rb +64 -0
- data/lib/latitude/api/client.rb +80 -0
- data/lib/latitude/api/configuration.rb +88 -0
- data/lib/latitude/api/errors.rb +134 -0
- data/lib/latitude/api/json_api.rb +40 -0
- data/lib/latitude/api/list_object.rb +129 -0
- data/lib/latitude/api/objects.rb +216 -0
- data/lib/latitude/api/operations/action.rb +41 -0
- data/lib/latitude/api/operations/create.rb +22 -0
- data/lib/latitude/api/operations/delete.rb +22 -0
- data/lib/latitude/api/operations/list.rb +54 -0
- data/lib/latitude/api/operations/nested.rb +53 -0
- data/lib/latitude/api/operations/retrieve.rb +22 -0
- data/lib/latitude/api/operations/update.rb +22 -0
- data/lib/latitude/api/request_executor.rb +217 -0
- data/lib/latitude/api/request_options.rb +86 -0
- data/lib/latitude/api/request_params.rb +70 -0
- data/lib/latitude/api/resources/api_key.rb +61 -0
- data/lib/latitude/api/resources/billing_usage.rb +51 -0
- data/lib/latitude/api/resources/elastic_ip.rb +96 -0
- data/lib/latitude/api/resources/event.rb +55 -0
- data/lib/latitude/api/resources/firewall.rb +129 -0
- data/lib/latitude/api/resources/ip.rb +110 -0
- data/lib/latitude/api/resources/kubernetes_cluster.rb +184 -0
- data/lib/latitude/api/resources/plan.rb +658 -0
- data/lib/latitude/api/resources/project.rb +179 -0
- data/lib/latitude/api/resources/region.rb +41 -0
- data/lib/latitude/api/resources/role.rb +20 -0
- data/lib/latitude/api/resources/server.rb +251 -0
- data/lib/latitude/api/resources/ssh_key.rb +44 -0
- data/lib/latitude/api/resources/storage_filesystem.rb +36 -0
- data/lib/latitude/api/resources/storage_object.rb +85 -0
- data/lib/latitude/api/resources/storage_volume.rb +64 -0
- data/lib/latitude/api/resources/tag.rb +34 -0
- data/lib/latitude/api/resources/team.rb +169 -0
- data/lib/latitude/api/resources/traffic.rb +215 -0
- data/lib/latitude/api/resources/user_data.rb +38 -0
- data/lib/latitude/api/resources/user_profile.rb +51 -0
- data/lib/latitude/api/resources/user_team.rb +90 -0
- data/lib/latitude/api/resources/virtual_machine.rb +146 -0
- data/lib/latitude/api/resources/virtual_network.rb +162 -0
- data/lib/latitude/api/resources/vpn_session.rb +80 -0
- data/lib/latitude/api/singleton_api_resource.rb +22 -0
- data/lib/latitude/api/util.rb +64 -0
- data/lib/latitude/api/version.rb +7 -0
- data/lib/latitude/api.rb +147 -0
- data/lib/latitude/metadata/errors.rb +18 -0
- data/lib/latitude/metadata/session.rb +109 -0
- data/lib/latitude/metadata.rb +43 -0
- data/lib/latitude.rb +4 -0
- metadata +132 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] tags
|
|
7
|
+
# @return [Array<Latitude::API::Objects::Tag>]
|
|
8
|
+
# @!attribute [rw] name
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] slug
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] description
|
|
13
|
+
# @return [String]
|
|
14
|
+
# @!attribute [rw] bandwidth_alert
|
|
15
|
+
# @return [Boolean]
|
|
16
|
+
# @!attribute [rw] environment
|
|
17
|
+
# @return [String]
|
|
18
|
+
# @!attribute [rw] provisioning_type
|
|
19
|
+
# @return [String]
|
|
20
|
+
# @!attribute [rw] billing_type
|
|
21
|
+
# @return [String]
|
|
22
|
+
# @!attribute [rw] billing_method
|
|
23
|
+
# @return [String]
|
|
24
|
+
# @!attribute [rw] billing
|
|
25
|
+
# @return [Latitude::API::Objects::Billing]
|
|
26
|
+
# @!attribute [rw] team
|
|
27
|
+
# @return [Latitude::API::Objects::Team]
|
|
28
|
+
# @!attribute [rw] stats
|
|
29
|
+
# @return [Latitude::API::Objects::Stats]
|
|
30
|
+
# @!attribute [r] created_at
|
|
31
|
+
# @return [Time]
|
|
32
|
+
# @!attribute [r] updated_at
|
|
33
|
+
# @return [Time]
|
|
34
|
+
# @!attribute [rw] cost
|
|
35
|
+
# @return [String]
|
|
36
|
+
class Project < APIResource
|
|
37
|
+
attribute :tags, [Objects::Tag]
|
|
38
|
+
attribute :name, :string
|
|
39
|
+
attribute :slug, :string
|
|
40
|
+
attribute :description, :string
|
|
41
|
+
attribute :bandwidth_alert, :boolean
|
|
42
|
+
attribute :environment, :string
|
|
43
|
+
attribute :provisioning_type, :string
|
|
44
|
+
attribute :billing_type, :string
|
|
45
|
+
attribute :billing_method, :string
|
|
46
|
+
attribute :billing, Objects::Billing
|
|
47
|
+
attribute :team, Objects::Team
|
|
48
|
+
attribute :stats, Objects::Stats
|
|
49
|
+
attribute :created_at, :time, read_only: true
|
|
50
|
+
attribute :updated_at, :time, read_only: true
|
|
51
|
+
attribute :cost, :string
|
|
52
|
+
|
|
53
|
+
resource_type "projects"
|
|
54
|
+
resource_path "/projects"
|
|
55
|
+
id_prefix "proj_"
|
|
56
|
+
|
|
57
|
+
extend Operations::List
|
|
58
|
+
extend Operations::Create
|
|
59
|
+
extend Operations::Retrieve
|
|
60
|
+
extend Operations::Update
|
|
61
|
+
extend Operations::Delete
|
|
62
|
+
extend Operations::Nested
|
|
63
|
+
|
|
64
|
+
nested_resource :ssh_keys, class_name: "Latitude::API::Resources::Project::SSHKey"
|
|
65
|
+
nested_resource :user_data, class_name: "Latitude::API::Resources::Project::UserData"
|
|
66
|
+
|
|
67
|
+
# @!attribute [rw] tags
|
|
68
|
+
|
|
69
|
+
# @return [Array<Latitude::API::Objects::Tag>]
|
|
70
|
+
|
|
71
|
+
# @!attribute [rw] name
|
|
72
|
+
|
|
73
|
+
# @return [String]
|
|
74
|
+
|
|
75
|
+
# @!attribute [rw] public_key
|
|
76
|
+
|
|
77
|
+
# @return [String]
|
|
78
|
+
|
|
79
|
+
# @!attribute [rw] fingerprint
|
|
80
|
+
|
|
81
|
+
# @return [String]
|
|
82
|
+
|
|
83
|
+
# @!attribute [r] created_at
|
|
84
|
+
|
|
85
|
+
# @return [Time]
|
|
86
|
+
|
|
87
|
+
# @!attribute [r] updated_at
|
|
88
|
+
|
|
89
|
+
# @return [Time]
|
|
90
|
+
|
|
91
|
+
# @!attribute [rw] project
|
|
92
|
+
|
|
93
|
+
# @return [Latitude::API::Objects::Project]
|
|
94
|
+
|
|
95
|
+
# @!attribute [rw] user
|
|
96
|
+
|
|
97
|
+
# @return [Latitude::API::Objects::User]
|
|
98
|
+
|
|
99
|
+
class SSHKey < APIResource
|
|
100
|
+
|
|
101
|
+
attribute :tags, [Objects::Tag]
|
|
102
|
+
|
|
103
|
+
attribute :name, :string
|
|
104
|
+
|
|
105
|
+
attribute :public_key, :string
|
|
106
|
+
|
|
107
|
+
attribute :fingerprint, :string
|
|
108
|
+
|
|
109
|
+
attribute :created_at, :time, read_only: true
|
|
110
|
+
|
|
111
|
+
attribute :updated_at, :time, read_only: true
|
|
112
|
+
|
|
113
|
+
attribute :project, Objects::Project
|
|
114
|
+
|
|
115
|
+
attribute :user, Objects::User
|
|
116
|
+
|
|
117
|
+
resource_type "ssh_keys"
|
|
118
|
+
resource_path "/projects/:project_id/ssh_keys"
|
|
119
|
+
id_prefix "ssh_"
|
|
120
|
+
|
|
121
|
+
extend Operations::List
|
|
122
|
+
extend Operations::Create
|
|
123
|
+
extend Operations::Retrieve
|
|
124
|
+
extend Operations::Update
|
|
125
|
+
extend Operations::Delete
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @!attribute [rw] description
|
|
129
|
+
|
|
130
|
+
# @return [String]
|
|
131
|
+
|
|
132
|
+
# @!attribute [rw] content
|
|
133
|
+
|
|
134
|
+
# @return [String]
|
|
135
|
+
|
|
136
|
+
# @!attribute [r] created_at
|
|
137
|
+
|
|
138
|
+
# @return [Time]
|
|
139
|
+
|
|
140
|
+
# @!attribute [r] updated_at
|
|
141
|
+
|
|
142
|
+
# @return [Time]
|
|
143
|
+
|
|
144
|
+
# @!attribute [rw] decoded_content
|
|
145
|
+
|
|
146
|
+
# @return [String]
|
|
147
|
+
|
|
148
|
+
# @!attribute [rw] project
|
|
149
|
+
|
|
150
|
+
# @return [Latitude::API::Objects::Project]
|
|
151
|
+
|
|
152
|
+
class UserData < APIResource
|
|
153
|
+
|
|
154
|
+
attribute :description, :string
|
|
155
|
+
|
|
156
|
+
attribute :content, :string
|
|
157
|
+
|
|
158
|
+
attribute :created_at, :time, read_only: true
|
|
159
|
+
|
|
160
|
+
attribute :updated_at, :time, read_only: true
|
|
161
|
+
|
|
162
|
+
attribute :decoded_content, :string
|
|
163
|
+
|
|
164
|
+
attribute :project, Objects::Project
|
|
165
|
+
|
|
166
|
+
resource_type "user_data"
|
|
167
|
+
resource_path "/projects/:project_id/user_data"
|
|
168
|
+
id_prefix "ud_"
|
|
169
|
+
|
|
170
|
+
extend Operations::List
|
|
171
|
+
extend Operations::Create
|
|
172
|
+
extend Operations::Retrieve
|
|
173
|
+
extend Operations::Update
|
|
174
|
+
extend Operations::Delete
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
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] slug
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] facility
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] country
|
|
13
|
+
# @return [Country]
|
|
14
|
+
# @!attribute [rw] type
|
|
15
|
+
# @return [String]
|
|
16
|
+
class Region < APIResource
|
|
17
|
+
# @!attribute [r] name
|
|
18
|
+
# @return [String]
|
|
19
|
+
# @!attribute [r] slug
|
|
20
|
+
# @return [String]
|
|
21
|
+
class Country < APIObject
|
|
22
|
+
attribute :name, :string, read_only: true
|
|
23
|
+
attribute :slug, :string, read_only: true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attribute :name, :string
|
|
27
|
+
attribute :slug, :string
|
|
28
|
+
attribute :facility, :string
|
|
29
|
+
attribute :country, Country
|
|
30
|
+
attribute :type, :string
|
|
31
|
+
|
|
32
|
+
resource_type "regions"
|
|
33
|
+
resource_path "/regions"
|
|
34
|
+
id_prefix "reg_"
|
|
35
|
+
|
|
36
|
+
extend Operations::List
|
|
37
|
+
extend Operations::Retrieve
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] name
|
|
7
|
+
# @return [String]
|
|
8
|
+
class Role < APIResource
|
|
9
|
+
attribute :name, :string
|
|
10
|
+
|
|
11
|
+
resource_type "roles"
|
|
12
|
+
resource_path "/roles"
|
|
13
|
+
id_prefix "role_"
|
|
14
|
+
|
|
15
|
+
extend Operations::List
|
|
16
|
+
extend Operations::Retrieve
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] hostname
|
|
7
|
+
# @return [String]
|
|
8
|
+
# @!attribute [rw] label
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] price
|
|
11
|
+
# @return [Integer]
|
|
12
|
+
# @!attribute [rw] ipmi_status
|
|
13
|
+
# @return [String]
|
|
14
|
+
# @!attribute [rw] scheduled_deletion_at
|
|
15
|
+
# @return [Time]
|
|
16
|
+
# @!attribute [rw] status
|
|
17
|
+
# @return [String]
|
|
18
|
+
# @!attribute [rw] role
|
|
19
|
+
# @return [String]
|
|
20
|
+
# @!attribute [rw] primary_ipv4
|
|
21
|
+
# @return [String]
|
|
22
|
+
# @!attribute [r] created_at
|
|
23
|
+
# @return [Time]
|
|
24
|
+
# @!attribute [rw] locked
|
|
25
|
+
# @return [Boolean]
|
|
26
|
+
# @!attribute [rw] team
|
|
27
|
+
# @return [Latitude::API::Objects::Team]
|
|
28
|
+
# @!attribute [rw] project
|
|
29
|
+
# @return [Latitude::API::Objects::Project]
|
|
30
|
+
# @!attribute [rw] region
|
|
31
|
+
# @return [Region]
|
|
32
|
+
# @!attribute [rw] tags
|
|
33
|
+
# @return [Array<Latitude::API::Objects::Tag>]
|
|
34
|
+
# @!attribute [rw] primary_ipv6
|
|
35
|
+
# @return [String]
|
|
36
|
+
# @!attribute [rw] rescue_allowed
|
|
37
|
+
# @return [Boolean]
|
|
38
|
+
# @!attribute [rw] plan
|
|
39
|
+
# @return [Plan]
|
|
40
|
+
# @!attribute [rw] interfaces
|
|
41
|
+
# @return [Array<Interface>]
|
|
42
|
+
# @!attribute [rw] operating_system
|
|
43
|
+
# @return [OperatingSystem]
|
|
44
|
+
# @!attribute [rw] specs
|
|
45
|
+
# @return [Spec]
|
|
46
|
+
class Server < APIResource
|
|
47
|
+
# @!attribute [r] id
|
|
48
|
+
# @return [String]
|
|
49
|
+
# @!attribute [r] name
|
|
50
|
+
# @return [String]
|
|
51
|
+
# @!attribute [r] slug
|
|
52
|
+
# @return [String]
|
|
53
|
+
# @!attribute [r] facility
|
|
54
|
+
# @return [String]
|
|
55
|
+
# @!attribute [r] rack_id
|
|
56
|
+
# @return [String]
|
|
57
|
+
class Site < APIObject
|
|
58
|
+
attribute :id, :string, read_only: true
|
|
59
|
+
attribute :name, :string, read_only: true
|
|
60
|
+
attribute :slug, :string, read_only: true
|
|
61
|
+
attribute :facility, :string, read_only: true
|
|
62
|
+
attribute :rack_id, :string, read_only: true
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @!attribute [r] city
|
|
66
|
+
# @return [String]
|
|
67
|
+
# @!attribute [r] country
|
|
68
|
+
# @return [String]
|
|
69
|
+
# @!attribute [r] site
|
|
70
|
+
# @return [Site]
|
|
71
|
+
class Region < APIObject
|
|
72
|
+
attribute :city, :string, read_only: true
|
|
73
|
+
attribute :country, :string, read_only: true
|
|
74
|
+
attribute :site, Site, read_only: true
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @!attribute [r] id
|
|
78
|
+
# @return [String]
|
|
79
|
+
# @!attribute [r] name
|
|
80
|
+
# @return [String]
|
|
81
|
+
# @!attribute [r] slug
|
|
82
|
+
# @return [String]
|
|
83
|
+
# @!attribute [r] billing
|
|
84
|
+
# @return [String]
|
|
85
|
+
class Plan < APIObject
|
|
86
|
+
attribute :id, :string, read_only: true
|
|
87
|
+
attribute :name, :string, read_only: true
|
|
88
|
+
attribute :slug, :string, read_only: true
|
|
89
|
+
attribute :billing, :string, read_only: true
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @!attribute [r] role
|
|
93
|
+
# @return [String]
|
|
94
|
+
# @!attribute [r] name
|
|
95
|
+
# @return [String]
|
|
96
|
+
# @!attribute [r] mac_address
|
|
97
|
+
# @return [String]
|
|
98
|
+
# @!attribute [r] description
|
|
99
|
+
# @return [String]
|
|
100
|
+
class Interface < APIObject
|
|
101
|
+
attribute :role, :string, read_only: true
|
|
102
|
+
attribute :name, :string, read_only: true
|
|
103
|
+
attribute :mac_address, :string, read_only: true
|
|
104
|
+
attribute :description, :string, read_only: true
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# @!attribute [r] raid
|
|
108
|
+
# @return [Boolean]
|
|
109
|
+
# @!attribute [r] ssh_keys
|
|
110
|
+
# @return [Boolean]
|
|
111
|
+
class Feature < APIObject
|
|
112
|
+
attribute :raid, :boolean, read_only: true
|
|
113
|
+
attribute :ssh_keys, :boolean, read_only: true
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# @!attribute [r] name
|
|
117
|
+
# @return [String]
|
|
118
|
+
# @!attribute [r] slug
|
|
119
|
+
# @return [String]
|
|
120
|
+
# @!attribute [r] series
|
|
121
|
+
# @return [String]
|
|
122
|
+
class Distro < APIObject
|
|
123
|
+
attribute :name, :string, read_only: true
|
|
124
|
+
attribute :slug, :string, read_only: true
|
|
125
|
+
attribute :series, :string, read_only: true
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @!attribute [r] name
|
|
129
|
+
# @return [String]
|
|
130
|
+
# @!attribute [r] slug
|
|
131
|
+
# @return [String]
|
|
132
|
+
# @!attribute [r] version
|
|
133
|
+
# @return [String]
|
|
134
|
+
# @!attribute [r] features
|
|
135
|
+
# @return [Feature]
|
|
136
|
+
# @!attribute [r] distro
|
|
137
|
+
# @return [Distro]
|
|
138
|
+
class OperatingSystem < APIObject
|
|
139
|
+
attribute :name, :string, read_only: true
|
|
140
|
+
attribute :slug, :string, read_only: true
|
|
141
|
+
attribute :version, :string, read_only: true
|
|
142
|
+
attribute :features, Feature, read_only: true
|
|
143
|
+
attribute :distro, Distro, read_only: true
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# @!attribute [r] cpu
|
|
147
|
+
# @return [String]
|
|
148
|
+
# @!attribute [r] disk
|
|
149
|
+
# @return [String]
|
|
150
|
+
# @!attribute [r] ram
|
|
151
|
+
# @return [String]
|
|
152
|
+
# @!attribute [r] nic
|
|
153
|
+
# @return [String]
|
|
154
|
+
# @!attribute [r] gpu
|
|
155
|
+
# @return [String]
|
|
156
|
+
class Spec < APIObject
|
|
157
|
+
attribute :cpu, :string, read_only: true
|
|
158
|
+
attribute :disk, :string, read_only: true
|
|
159
|
+
attribute :ram, :string, read_only: true
|
|
160
|
+
attribute :nic, :string, read_only: true
|
|
161
|
+
attribute :gpu, :string, read_only: true
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
attribute :hostname, :string
|
|
165
|
+
attribute :label, :string
|
|
166
|
+
attribute :price, :integer
|
|
167
|
+
attribute :ipmi_status, :string
|
|
168
|
+
attribute :scheduled_deletion_at, :time
|
|
169
|
+
attribute :status, :string
|
|
170
|
+
attribute :role, :string
|
|
171
|
+
attribute :primary_ipv4, :string
|
|
172
|
+
attribute :created_at, :time, read_only: true
|
|
173
|
+
attribute :locked, :boolean
|
|
174
|
+
attribute :team, Objects::Team
|
|
175
|
+
attribute :project, Objects::Project
|
|
176
|
+
attribute :region, Region
|
|
177
|
+
attribute :tags, [Objects::Tag]
|
|
178
|
+
attribute :primary_ipv6, :string
|
|
179
|
+
attribute :rescue_allowed, :boolean
|
|
180
|
+
attribute :plan, Plan
|
|
181
|
+
attribute :interfaces, [Interface]
|
|
182
|
+
attribute :operating_system, OperatingSystem
|
|
183
|
+
attribute :specs, Spec
|
|
184
|
+
|
|
185
|
+
resource_type "servers"
|
|
186
|
+
resource_path "/servers"
|
|
187
|
+
id_prefix "sv_"
|
|
188
|
+
|
|
189
|
+
extend Operations::List
|
|
190
|
+
extend Operations::Create
|
|
191
|
+
extend Operations::Retrieve
|
|
192
|
+
extend Operations::Update
|
|
193
|
+
extend Operations::Delete
|
|
194
|
+
extend Operations::Action
|
|
195
|
+
|
|
196
|
+
action :power_action, path: "actions", type: "actions", accepts: %i[action]
|
|
197
|
+
action :reboot, path: "actions", type: "actions", attributes: { action: "reboot" }
|
|
198
|
+
action :power_on, path: "actions", type: "actions", attributes: { action: "power_on" }
|
|
199
|
+
action :power_off, path: "actions", type: "actions", attributes: { action: "power_off" }
|
|
200
|
+
action :reset, path: "actions", type: "actions", attributes: { action: "reset" }
|
|
201
|
+
action :lock, path: "lock"
|
|
202
|
+
action :unlock, path: "unlock"
|
|
203
|
+
action :rescue_mode, path: "rescue_mode"
|
|
204
|
+
action :exit_rescue_mode, path: "exit_rescue_mode"
|
|
205
|
+
action :remote_access, path: "remote_access"
|
|
206
|
+
action :schedule_deletion, path: "schedule_deletion",
|
|
207
|
+
accepts: %i[at reason]
|
|
208
|
+
action :unschedule_deletion, path: "schedule_deletion", method: :delete
|
|
209
|
+
|
|
210
|
+
action :reinstall, path: "reinstall", type: "reinstalls",
|
|
211
|
+
accepts: %i[operating_system ipxe hostname ssh_keys user_data raid partitions]
|
|
212
|
+
|
|
213
|
+
action :create_out_of_band_connection, path: "out_of_band_connection", type: "out_of_band_connections",
|
|
214
|
+
accepts: %i[port ssh_key_id]
|
|
215
|
+
action :list_out_of_band_connections, path: "out_of_band_connection", method: :get
|
|
216
|
+
|
|
217
|
+
class << self
|
|
218
|
+
def deploy_config(id, opts = {}, path_params: {})
|
|
219
|
+
params = opts.is_a?(Hash) ? opts : {}
|
|
220
|
+
path_params = extract_path_params(params, path_param_keys) if path_params.empty?
|
|
221
|
+
parsed = execute_request(
|
|
222
|
+
method: :get,
|
|
223
|
+
path: "#{instance_url(id, path_params: path_params)}/deploy_config",
|
|
224
|
+
opts: params,
|
|
225
|
+
)
|
|
226
|
+
parsed
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def update_deploy_config(id, attributes = {}, opts = {})
|
|
230
|
+
body = JSONAPI.encode(type: "deploy_config", id: id, attributes: attributes)
|
|
231
|
+
parsed = execute_request(
|
|
232
|
+
method: :patch,
|
|
233
|
+
path: "#{instance_url(id)}/deploy_config",
|
|
234
|
+
body: body,
|
|
235
|
+
opts: opts,
|
|
236
|
+
)
|
|
237
|
+
parsed
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
def deploy_config(opts = {})
|
|
242
|
+
self.class.deploy_config(id, opts)
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def update_deploy_config(attributes, opts = {})
|
|
246
|
+
self.class.update_deploy_config(id, attributes, opts)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] tags
|
|
7
|
+
# @return [Array<Latitude::API::Objects::Tag>]
|
|
8
|
+
# @!attribute [rw] name
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] public_key
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] fingerprint
|
|
13
|
+
# @return [String]
|
|
14
|
+
# @!attribute [r] created_at
|
|
15
|
+
# @return [Time]
|
|
16
|
+
# @!attribute [r] updated_at
|
|
17
|
+
# @return [Time]
|
|
18
|
+
# @!attribute [rw] project
|
|
19
|
+
# @return [Latitude::API::Objects::Project]
|
|
20
|
+
# @!attribute [rw] user
|
|
21
|
+
# @return [Latitude::API::Objects::User]
|
|
22
|
+
class SSHKey < APIResource
|
|
23
|
+
attribute :tags, [Objects::Tag]
|
|
24
|
+
attribute :name, :string
|
|
25
|
+
attribute :public_key, :string
|
|
26
|
+
attribute :fingerprint, :string
|
|
27
|
+
attribute :created_at, :time, read_only: true
|
|
28
|
+
attribute :updated_at, :time, read_only: true
|
|
29
|
+
attribute :project, Objects::Project
|
|
30
|
+
attribute :user, Objects::User
|
|
31
|
+
|
|
32
|
+
resource_type "ssh_keys"
|
|
33
|
+
resource_path "/ssh_keys"
|
|
34
|
+
id_prefix "ssh_"
|
|
35
|
+
|
|
36
|
+
extend Operations::List
|
|
37
|
+
extend Operations::Create
|
|
38
|
+
extend Operations::Retrieve
|
|
39
|
+
extend Operations::Update
|
|
40
|
+
extend Operations::Delete
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
module Storage
|
|
7
|
+
# @!attribute [rw] name
|
|
8
|
+
# @return [String]
|
|
9
|
+
# @!attribute [rw] size_in_gb
|
|
10
|
+
# @return [Integer]
|
|
11
|
+
# @!attribute [r] created_at
|
|
12
|
+
# @return [Time]
|
|
13
|
+
# @!attribute [rw] project
|
|
14
|
+
# @return [Latitude::API::Objects::Project]
|
|
15
|
+
# @!attribute [rw] team
|
|
16
|
+
# @return [Latitude::API::Objects::Team]
|
|
17
|
+
class Filesystem < APIResource
|
|
18
|
+
attribute :name, :string
|
|
19
|
+
attribute :size_in_gb, :integer
|
|
20
|
+
attribute :created_at, :time, read_only: true
|
|
21
|
+
attribute :project, Objects::Project
|
|
22
|
+
attribute :team, Objects::Team
|
|
23
|
+
|
|
24
|
+
resource_type "filesystems"
|
|
25
|
+
resource_path "/storage/filesystems"
|
|
26
|
+
id_prefix "fs_"
|
|
27
|
+
|
|
28
|
+
extend Operations::List
|
|
29
|
+
extend Operations::Create
|
|
30
|
+
extend Operations::Update
|
|
31
|
+
extend Operations::Delete
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
module Storage
|
|
7
|
+
# @!attribute [rw] name
|
|
8
|
+
# @return [String]
|
|
9
|
+
# @!attribute [rw] storage_type
|
|
10
|
+
# @return [String]
|
|
11
|
+
# @!attribute [rw] storage_class
|
|
12
|
+
# @return [String]
|
|
13
|
+
# @!attribute [r] created_at
|
|
14
|
+
# @return [Time]
|
|
15
|
+
# @!attribute [rw] bucket_name
|
|
16
|
+
# @return [String]
|
|
17
|
+
# @!attribute [rw] endpoint
|
|
18
|
+
# @return [String]
|
|
19
|
+
# @!attribute [rw] access_key
|
|
20
|
+
# @return [String]
|
|
21
|
+
# @!attribute [rw] secret_key
|
|
22
|
+
# @return [String]
|
|
23
|
+
# @!attribute [rw] versioning
|
|
24
|
+
# @return [Boolean]
|
|
25
|
+
# @!attribute [rw] locking
|
|
26
|
+
# @return [Boolean]
|
|
27
|
+
# @!attribute [rw] retention_mode
|
|
28
|
+
# @return [String]
|
|
29
|
+
# @!attribute [rw] retention_period
|
|
30
|
+
# @return [String]
|
|
31
|
+
# @!attribute [rw] region
|
|
32
|
+
# @return [Region]
|
|
33
|
+
# @!attribute [rw] project
|
|
34
|
+
# @return [Latitude::API::Objects::Project]
|
|
35
|
+
# @!attribute [rw] team
|
|
36
|
+
# @return [Latitude::API::Objects::Team]
|
|
37
|
+
class Object < APIResource
|
|
38
|
+
# @!attribute [r] id
|
|
39
|
+
# @return [String]
|
|
40
|
+
# @!attribute [r] city
|
|
41
|
+
# @return [String]
|
|
42
|
+
# @!attribute [r] country
|
|
43
|
+
# @return [String]
|
|
44
|
+
class Region < APIObject
|
|
45
|
+
attribute :id, :string, read_only: true
|
|
46
|
+
attribute :city, :string, read_only: true
|
|
47
|
+
attribute :country, :string, read_only: true
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
attribute :name, :string
|
|
51
|
+
attribute :storage_type, :string
|
|
52
|
+
attribute :storage_class, :string
|
|
53
|
+
attribute :created_at, :time, read_only: true
|
|
54
|
+
attribute :bucket_name, :string
|
|
55
|
+
attribute :endpoint, :string
|
|
56
|
+
attribute :access_key, :string
|
|
57
|
+
attribute :secret_key, :string
|
|
58
|
+
attribute :versioning, :boolean
|
|
59
|
+
attribute :locking, :boolean
|
|
60
|
+
attribute :retention_mode, :string
|
|
61
|
+
attribute :retention_period, :string
|
|
62
|
+
attribute :region, Region
|
|
63
|
+
attribute :project, Objects::Project
|
|
64
|
+
attribute :team, Objects::Team
|
|
65
|
+
|
|
66
|
+
resource_type "object_storages"
|
|
67
|
+
resource_path "/storage/objects"
|
|
68
|
+
id_prefix "objs_"
|
|
69
|
+
|
|
70
|
+
extend Operations::List
|
|
71
|
+
extend Operations::Retrieve
|
|
72
|
+
extend Operations::Delete
|
|
73
|
+
|
|
74
|
+
class << self
|
|
75
|
+
def create(params = {}, opts = {})
|
|
76
|
+
body = JSONAPI.encode(type: "objects", attributes: params)
|
|
77
|
+
parsed = execute_request(method: :post, path: resource_path, body: body, opts: opts)
|
|
78
|
+
construct_from(parsed, opts: opts)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|