lex-nautobot 0.1.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.
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/nautobot/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Nautobot
8
+ module Runners
9
+ module Cloud
10
+ include Legion::Extensions::Nautobot::Helpers::Client
11
+
12
+ # Cloud Accounts
13
+ def list_cloud_accounts(url: nil, token: nil, **params)
14
+ resp = connection(url: url, token: token).get('/api/cloud/cloud-accounts/', params)
15
+ resp.body
16
+ end
17
+
18
+ def get_cloud_account(id:, url: nil, token: nil, **)
19
+ resp = connection(url: url, token: token).get("/api/cloud/cloud-accounts/#{id}/")
20
+ resp.body
21
+ end
22
+
23
+ def create_cloud_account(url: nil, token: nil, read_only: false, **attrs)
24
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
25
+
26
+ resp = connection(url: url, token: token).post('/api/cloud/cloud-accounts/', attrs)
27
+ resp.body
28
+ end
29
+
30
+ def update_cloud_account(id:, url: nil, token: nil, read_only: false, **attrs)
31
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
32
+
33
+ resp = connection(url: url, token: token).patch("/api/cloud/cloud-accounts/#{id}/", attrs)
34
+ resp.body
35
+ end
36
+
37
+ def delete_cloud_account(id:, url: nil, token: nil, read_only: false, **)
38
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
39
+
40
+ connection(url: url, token: token).delete("/api/cloud/cloud-accounts/#{id}/")
41
+ end
42
+
43
+ # Cloud Networks
44
+ def list_cloud_networks(url: nil, token: nil, **params)
45
+ resp = connection(url: url, token: token).get('/api/cloud/cloud-networks/', params)
46
+ resp.body
47
+ end
48
+
49
+ def get_cloud_network(id:, url: nil, token: nil, **)
50
+ resp = connection(url: url, token: token).get("/api/cloud/cloud-networks/#{id}/")
51
+ resp.body
52
+ end
53
+
54
+ def create_cloud_network(url: nil, token: nil, read_only: false, **attrs)
55
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
56
+
57
+ resp = connection(url: url, token: token).post('/api/cloud/cloud-networks/', attrs)
58
+ resp.body
59
+ end
60
+
61
+ def update_cloud_network(id:, url: nil, token: nil, read_only: false, **attrs)
62
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
63
+
64
+ resp = connection(url: url, token: token).patch("/api/cloud/cloud-networks/#{id}/", attrs)
65
+ resp.body
66
+ end
67
+
68
+ def delete_cloud_network(id:, url: nil, token: nil, read_only: false, **)
69
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
70
+
71
+ connection(url: url, token: token).delete("/api/cloud/cloud-networks/#{id}/")
72
+ end
73
+
74
+ # Cloud Services
75
+ def list_cloud_services(url: nil, token: nil, **params)
76
+ resp = connection(url: url, token: token).get('/api/cloud/cloud-services/', params)
77
+ resp.body
78
+ end
79
+
80
+ def get_cloud_service(id:, url: nil, token: nil, **)
81
+ resp = connection(url: url, token: token).get("/api/cloud/cloud-services/#{id}/")
82
+ resp.body
83
+ end
84
+
85
+ def create_cloud_service(url: nil, token: nil, read_only: false, **attrs)
86
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
87
+
88
+ resp = connection(url: url, token: token).post('/api/cloud/cloud-services/', attrs)
89
+ resp.body
90
+ end
91
+
92
+ # Cloud Resource Types
93
+ def list_cloud_resource_types(url: nil, token: nil, **params)
94
+ resp = connection(url: url, token: token).get('/api/cloud/cloud-resource-types/', params)
95
+ resp.body
96
+ end
97
+
98
+ def get_cloud_resource_type(id:, url: nil, token: nil, **)
99
+ resp = connection(url: url, token: token).get("/api/cloud/cloud-resource-types/#{id}/")
100
+ resp.body
101
+ end
102
+
103
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
104
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,351 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/nautobot/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Nautobot
8
+ module Runners
9
+ module Dcim
10
+ include Legion::Extensions::Nautobot::Helpers::Client
11
+
12
+ # Locations
13
+ def list_location_types(url: nil, token: nil, **params)
14
+ resp = connection(url: url, token: token).get('/api/dcim/location-types/', params)
15
+ resp.body
16
+ end
17
+
18
+ def get_location_type(id:, url: nil, token: nil, **)
19
+ resp = connection(url: url, token: token).get("/api/dcim/location-types/#{id}/")
20
+ resp.body
21
+ end
22
+
23
+ def create_location_type(url: nil, token: nil, read_only: false, **attrs)
24
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
25
+
26
+ resp = connection(url: url, token: token).post('/api/dcim/location-types/', attrs)
27
+ resp.body
28
+ end
29
+
30
+ def list_locations(url: nil, token: nil, **params)
31
+ resp = connection(url: url, token: token).get('/api/dcim/locations/', params)
32
+ resp.body
33
+ end
34
+
35
+ def get_location(id:, url: nil, token: nil, **)
36
+ resp = connection(url: url, token: token).get("/api/dcim/locations/#{id}/")
37
+ resp.body
38
+ end
39
+
40
+ def create_location(url: nil, token: nil, read_only: false, **attrs)
41
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
42
+
43
+ resp = connection(url: url, token: token).post('/api/dcim/locations/', attrs)
44
+ resp.body
45
+ end
46
+
47
+ def update_location(id:, url: nil, token: nil, read_only: false, **attrs)
48
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
49
+
50
+ resp = connection(url: url, token: token).patch("/api/dcim/locations/#{id}/", attrs)
51
+ resp.body
52
+ end
53
+
54
+ def delete_location(id:, url: nil, token: nil, read_only: false, **)
55
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
56
+
57
+ connection(url: url, token: token).delete("/api/dcim/locations/#{id}/")
58
+ end
59
+
60
+ # Racks
61
+ def list_rack_groups(url: nil, token: nil, **params)
62
+ resp = connection(url: url, token: token).get('/api/dcim/rack-groups/', params)
63
+ resp.body
64
+ end
65
+
66
+ def list_racks(url: nil, token: nil, **params)
67
+ resp = connection(url: url, token: token).get('/api/dcim/racks/', params)
68
+ resp.body
69
+ end
70
+
71
+ def get_rack(id:, url: nil, token: nil, **)
72
+ resp = connection(url: url, token: token).get("/api/dcim/racks/#{id}/")
73
+ resp.body
74
+ end
75
+
76
+ def create_rack(url: nil, token: nil, read_only: false, **attrs)
77
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
78
+
79
+ resp = connection(url: url, token: token).post('/api/dcim/racks/', attrs)
80
+ resp.body
81
+ end
82
+
83
+ def update_rack(id:, url: nil, token: nil, read_only: false, **attrs)
84
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
85
+
86
+ resp = connection(url: url, token: token).patch("/api/dcim/racks/#{id}/", attrs)
87
+ resp.body
88
+ end
89
+
90
+ def delete_rack(id:, url: nil, token: nil, read_only: false, **)
91
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
92
+
93
+ connection(url: url, token: token).delete("/api/dcim/racks/#{id}/")
94
+ end
95
+
96
+ def list_rack_reservations(url: nil, token: nil, **params)
97
+ resp = connection(url: url, token: token).get('/api/dcim/rack-reservations/', params)
98
+ resp.body
99
+ end
100
+
101
+ # Manufacturers & Device Types
102
+ def list_manufacturers(url: nil, token: nil, **params)
103
+ resp = connection(url: url, token: token).get('/api/dcim/manufacturers/', params)
104
+ resp.body
105
+ end
106
+
107
+ def get_manufacturer(id:, url: nil, token: nil, **)
108
+ resp = connection(url: url, token: token).get("/api/dcim/manufacturers/#{id}/")
109
+ resp.body
110
+ end
111
+
112
+ def create_manufacturer(url: nil, token: nil, read_only: false, **attrs)
113
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
114
+
115
+ resp = connection(url: url, token: token).post('/api/dcim/manufacturers/', attrs)
116
+ resp.body
117
+ end
118
+
119
+ def list_device_types(url: nil, token: nil, **params)
120
+ resp = connection(url: url, token: token).get('/api/dcim/device-types/', params)
121
+ resp.body
122
+ end
123
+
124
+ def get_device_type(id:, url: nil, token: nil, **)
125
+ resp = connection(url: url, token: token).get("/api/dcim/device-types/#{id}/")
126
+ resp.body
127
+ end
128
+
129
+ def create_device_type(url: nil, token: nil, read_only: false, **attrs)
130
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
131
+
132
+ resp = connection(url: url, token: token).post('/api/dcim/device-types/', attrs)
133
+ resp.body
134
+ end
135
+
136
+ def list_device_families(url: nil, token: nil, **params)
137
+ resp = connection(url: url, token: token).get('/api/dcim/device-families/', params)
138
+ resp.body
139
+ end
140
+
141
+ def list_module_types(url: nil, token: nil, **params)
142
+ resp = connection(url: url, token: token).get('/api/dcim/module-types/', params)
143
+ resp.body
144
+ end
145
+
146
+ # Platforms
147
+ def list_platforms(url: nil, token: nil, **params)
148
+ resp = connection(url: url, token: token).get('/api/dcim/platforms/', params)
149
+ resp.body
150
+ end
151
+
152
+ def get_platform(id:, url: nil, token: nil, **)
153
+ resp = connection(url: url, token: token).get("/api/dcim/platforms/#{id}/")
154
+ resp.body
155
+ end
156
+
157
+ def create_platform(url: nil, token: nil, read_only: false, **attrs)
158
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
159
+
160
+ resp = connection(url: url, token: token).post('/api/dcim/platforms/', attrs)
161
+ resp.body
162
+ end
163
+
164
+ # Devices
165
+ def list_devices(url: nil, token: nil, **params)
166
+ resp = connection(url: url, token: token).get('/api/dcim/devices/', params)
167
+ resp.body
168
+ end
169
+
170
+ def get_device(id:, url: nil, token: nil, **)
171
+ resp = connection(url: url, token: token).get("/api/dcim/devices/#{id}/")
172
+ resp.body
173
+ end
174
+
175
+ def create_device(url: nil, token: nil, read_only: false, **attrs)
176
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
177
+
178
+ resp = connection(url: url, token: token).post('/api/dcim/devices/', attrs)
179
+ resp.body
180
+ end
181
+
182
+ def update_device(id:, url: nil, token: nil, read_only: false, **attrs)
183
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
184
+
185
+ resp = connection(url: url, token: token).patch("/api/dcim/devices/#{id}/", attrs)
186
+ resp.body
187
+ end
188
+
189
+ def delete_device(id:, url: nil, token: nil, read_only: false, **)
190
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
191
+
192
+ connection(url: url, token: token).delete("/api/dcim/devices/#{id}/")
193
+ end
194
+
195
+ # Interfaces
196
+ def list_interfaces(url: nil, token: nil, **params)
197
+ resp = connection(url: url, token: token).get('/api/dcim/interfaces/', params)
198
+ resp.body
199
+ end
200
+
201
+ def get_interface(id:, url: nil, token: nil, **)
202
+ resp = connection(url: url, token: token).get("/api/dcim/interfaces/#{id}/")
203
+ resp.body
204
+ end
205
+
206
+ def create_interface(url: nil, token: nil, read_only: false, **attrs)
207
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
208
+
209
+ resp = connection(url: url, token: token).post('/api/dcim/interfaces/', attrs)
210
+ resp.body
211
+ end
212
+
213
+ def update_interface(id:, url: nil, token: nil, read_only: false, **attrs)
214
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
215
+
216
+ resp = connection(url: url, token: token).patch("/api/dcim/interfaces/#{id}/", attrs)
217
+ resp.body
218
+ end
219
+
220
+ def delete_interface(id:, url: nil, token: nil, read_only: false, **)
221
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
222
+
223
+ connection(url: url, token: token).delete("/api/dcim/interfaces/#{id}/")
224
+ end
225
+
226
+ # Cables
227
+ def list_cables(url: nil, token: nil, **params)
228
+ resp = connection(url: url, token: token).get('/api/dcim/cables/', params)
229
+ resp.body
230
+ end
231
+
232
+ def get_cable(id:, url: nil, token: nil, **)
233
+ resp = connection(url: url, token: token).get("/api/dcim/cables/#{id}/")
234
+ resp.body
235
+ end
236
+
237
+ def create_cable(url: nil, token: nil, read_only: false, **attrs)
238
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
239
+
240
+ resp = connection(url: url, token: token).post('/api/dcim/cables/', attrs)
241
+ resp.body
242
+ end
243
+
244
+ def delete_cable(id:, url: nil, token: nil, read_only: false, **)
245
+ raise ReadOnlyError, 'Write operations disabled (read_only mode)' if read_only
246
+
247
+ connection(url: url, token: token).delete("/api/dcim/cables/#{id}/")
248
+ end
249
+
250
+ # Console & Power Ports
251
+ def list_console_ports(url: nil, token: nil, **params)
252
+ resp = connection(url: url, token: token).get('/api/dcim/console-ports/', params)
253
+ resp.body
254
+ end
255
+
256
+ def list_console_server_ports(url: nil, token: nil, **params)
257
+ resp = connection(url: url, token: token).get('/api/dcim/console-server-ports/', params)
258
+ resp.body
259
+ end
260
+
261
+ def list_power_ports(url: nil, token: nil, **params)
262
+ resp = connection(url: url, token: token).get('/api/dcim/power-ports/', params)
263
+ resp.body
264
+ end
265
+
266
+ def list_power_outlets(url: nil, token: nil, **params)
267
+ resp = connection(url: url, token: token).get('/api/dcim/power-outlets/', params)
268
+ resp.body
269
+ end
270
+
271
+ def list_power_panels(url: nil, token: nil, **params)
272
+ resp = connection(url: url, token: token).get('/api/dcim/power-panels/', params)
273
+ resp.body
274
+ end
275
+
276
+ def list_power_feeds(url: nil, token: nil, **params)
277
+ resp = connection(url: url, token: token).get('/api/dcim/power-feeds/', params)
278
+ resp.body
279
+ end
280
+
281
+ # Front/Rear Ports & Device Bays
282
+ def list_front_ports(url: nil, token: nil, **params)
283
+ resp = connection(url: url, token: token).get('/api/dcim/front-ports/', params)
284
+ resp.body
285
+ end
286
+
287
+ def list_rear_ports(url: nil, token: nil, **params)
288
+ resp = connection(url: url, token: token).get('/api/dcim/rear-ports/', params)
289
+ resp.body
290
+ end
291
+
292
+ def list_device_bays(url: nil, token: nil, **params)
293
+ resp = connection(url: url, token: token).get('/api/dcim/device-bays/', params)
294
+ resp.body
295
+ end
296
+
297
+ def list_inventory_items(url: nil, token: nil, **params)
298
+ resp = connection(url: url, token: token).get('/api/dcim/inventory-items/', params)
299
+ resp.body
300
+ end
301
+
302
+ # Virtual Chassis & Redundancy
303
+ def list_virtual_chassis(url: nil, token: nil, **params)
304
+ resp = connection(url: url, token: token).get('/api/dcim/virtual-chassis/', params)
305
+ resp.body
306
+ end
307
+
308
+ def get_virtual_chassis(id:, url: nil, token: nil, **)
309
+ resp = connection(url: url, token: token).get("/api/dcim/virtual-chassis/#{id}/")
310
+ resp.body
311
+ end
312
+
313
+ def list_device_redundancy_groups(url: nil, token: nil, **params)
314
+ resp = connection(url: url, token: token).get('/api/dcim/device-redundancy-groups/', params)
315
+ resp.body
316
+ end
317
+
318
+ def list_interface_redundancy_groups(url: nil, token: nil, **params)
319
+ resp = connection(url: url, token: token).get('/api/dcim/interface-redundancy-groups/', params)
320
+ resp.body
321
+ end
322
+
323
+ # Software
324
+ def list_software_versions(url: nil, token: nil, **params)
325
+ resp = connection(url: url, token: token).get('/api/dcim/software-versions/', params)
326
+ resp.body
327
+ end
328
+
329
+ def list_software_image_files(url: nil, token: nil, **params)
330
+ resp = connection(url: url, token: token).get('/api/dcim/software-image-files/', params)
331
+ resp.body
332
+ end
333
+
334
+ # Controllers
335
+ def list_controllers(url: nil, token: nil, **params)
336
+ resp = connection(url: url, token: token).get('/api/dcim/controllers/', params)
337
+ resp.body
338
+ end
339
+
340
+ def list_controller_managed_device_groups(url: nil, token: nil, **params)
341
+ resp = connection(url: url, token: token).get('/api/dcim/controller-managed-device-groups/', params)
342
+ resp.body
343
+ end
344
+
345
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
346
+ Legion::Extensions::Helpers.const_defined?(:Lex, false)
347
+ end
348
+ end
349
+ end
350
+ end
351
+ end