unikraft-cloud 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.
- checksums.yaml +7 -0
- data/LICENSE.md +28 -0
- data/README.md +587 -0
- data/lib/unikraft/cloud/api/controlplane/auth.gen.rb +83 -0
- data/lib/unikraft/cloud/api/controlplane/images.gen.rb +51 -0
- data/lib/unikraft/cloud/api/controlplane/metros.gen.rb +45 -0
- data/lib/unikraft/cloud/api/controlplane/models.gen.rb +865 -0
- data/lib/unikraft/cloud/api/controlplane/node_activation_service.gen.rb +79 -0
- data/lib/unikraft/cloud/api/controlplane/node_service.gen.rb +276 -0
- data/lib/unikraft/cloud/api/controlplane/resources.gen.rb +12 -0
- data/lib/unikraft/cloud/api/controlplane.rb +49 -0
- data/lib/unikraft/cloud/api/platform/audit.gen.rb +55 -0
- data/lib/unikraft/cloud/api/platform/autoscale.gen.rb +231 -0
- data/lib/unikraft/cloud/api/platform/certificates.gen.rb +168 -0
- data/lib/unikraft/cloud/api/platform/images.gen.rb +109 -0
- data/lib/unikraft/cloud/api/platform/instances.gen.rb +873 -0
- data/lib/unikraft/cloud/api/platform/models.gen.rb +6456 -0
- data/lib/unikraft/cloud/api/platform/node.gen.rb +45 -0
- data/lib/unikraft/cloud/api/platform/resources.gen.rb +16 -0
- data/lib/unikraft/cloud/api/platform/services.gen.rb +172 -0
- data/lib/unikraft/cloud/api/platform/users.gen.rb +134 -0
- data/lib/unikraft/cloud/api/platform/volumes.gen.rb +430 -0
- data/lib/unikraft/cloud/api/platform.rb +64 -0
- data/lib/unikraft/cloud/api.rb +45 -0
- data/lib/unikraft/cloud/client.rb +186 -0
- data/lib/unikraft/cloud/core/base64.rb +36 -0
- data/lib/unikraft/cloud/core/errors.rb +96 -0
- data/lib/unikraft/cloud/core/fanout.rb +150 -0
- data/lib/unikraft/cloud/core/handle.rb +214 -0
- data/lib/unikraft/cloud/core/handle_set.rb +105 -0
- data/lib/unikraft/cloud/core/http.rb +361 -0
- data/lib/unikraft/cloud/core/metro.rb +75 -0
- data/lib/unikraft/cloud/core/pagination.rb +43 -0
- data/lib/unikraft/cloud/core/patch.rb +113 -0
- data/lib/unikraft/cloud/core/pool.rb +97 -0
- data/lib/unikraft/cloud/core/ready.rb +145 -0
- data/lib/unikraft/cloud/core/ref.rb +95 -0
- data/lib/unikraft/cloud/core/resource.rb +399 -0
- data/lib/unikraft/cloud/core/response.rb +96 -0
- data/lib/unikraft/cloud/core/session.rb +182 -0
- data/lib/unikraft/cloud/core/url.rb +34 -0
- data/lib/unikraft/cloud/model.rb +194 -0
- data/lib/unikraft/cloud/resources/certificates.rb +57 -0
- data/lib/unikraft/cloud/resources/instances.rb +172 -0
- data/lib/unikraft/cloud/resources/service_groups.rb +36 -0
- data/lib/unikraft/cloud/resources/users.rb +39 -0
- data/lib/unikraft/cloud/resources/volumes.rb +93 -0
- data/lib/unikraft/cloud/version.rb +11 -0
- data/lib/unikraft/cloud.rb +29 -0
- metadata +89 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by openapi-gen; DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
require_relative "../../core/url"
|
|
6
|
+
require_relative "models.gen"
|
|
7
|
+
|
|
8
|
+
module Unikraft
|
|
9
|
+
module Cloud
|
|
10
|
+
class API
|
|
11
|
+
class ControlPlane
|
|
12
|
+
# Low-level "plumbing" client for the `NodeActivationService` resource of the
|
|
13
|
+
# ControlPlane API. Methods mirror the OpenAPI specification: they are
|
|
14
|
+
# named after the operationId and return the response envelope
|
|
15
|
+
# untouched.
|
|
16
|
+
class NodeActivationServiceApi
|
|
17
|
+
# @return [#request, #bytes, #stream] the transport, usually a
|
|
18
|
+
# {Unikraft::Cloud::Core::ApiClient}
|
|
19
|
+
attr_reader :client
|
|
20
|
+
|
|
21
|
+
# @param client [#request, #bytes, #stream] the transport
|
|
22
|
+
def initialize(client)
|
|
23
|
+
@client = client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Activates a new node, or renews an existing node's license. For first-time
|
|
27
|
+
# activation, a secret must be provided. For renewal, the CSR self-signature
|
|
28
|
+
# is used as proof of key possession and the secret is omitted.
|
|
29
|
+
#
|
|
30
|
+
# A renewal request may optionally also carry an HTTP message signature
|
|
31
|
+
# (RFC 9421) made with the node's current stable private key. When present
|
|
32
|
+
# and valid, it authorizes the CSR's public key to become the node's new
|
|
33
|
+
# stable identity even if it differs from the current one -- i.e. key
|
|
34
|
+
# rotation: prove who you are with the old key, then switch to the new one
|
|
35
|
+
# named in the CSR.
|
|
36
|
+
#
|
|
37
|
+
# `POST /v1/nodes/activate`
|
|
38
|
+
#
|
|
39
|
+
# @param body [Models::NodeActivateRequest, Hash, Array] the request body
|
|
40
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
41
|
+
# @return [Models::NodeActivateResponse, nil] the response envelope
|
|
42
|
+
# @raise [Unikraft::Cloud::Error]
|
|
43
|
+
def node_activate(body:, **options)
|
|
44
|
+
res = @client.request(
|
|
45
|
+
method: "POST",
|
|
46
|
+
path: "/v1/nodes/activate",
|
|
47
|
+
body:,
|
|
48
|
+
**options
|
|
49
|
+
)
|
|
50
|
+
Models::NodeActivateResponse.from(res)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Deactivates a node's license so it can no longer renew. The node's
|
|
54
|
+
# issued certificate remains valid until it naturally expires -- this
|
|
55
|
+
# only prevents renewal. The request must carry an HTTP message signature
|
|
56
|
+
# (RFC 9421) made with the node's stable private key; the node is
|
|
57
|
+
# identified by the signature, the same mechanism used by the private
|
|
58
|
+
# node-facing APIs (e.g. NodeHeartbeat).
|
|
59
|
+
#
|
|
60
|
+
# `POST /v1/nodes/deactivate`
|
|
61
|
+
#
|
|
62
|
+
# @param body [Models::NodeDeactivateRequest, Hash, Array] the request body
|
|
63
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
64
|
+
# @return [Models::NodeDeactivateResponse, nil] the response envelope
|
|
65
|
+
# @raise [Unikraft::Cloud::Error]
|
|
66
|
+
def node_deactivate(body:, **options)
|
|
67
|
+
res = @client.request(
|
|
68
|
+
method: "POST",
|
|
69
|
+
path: "/v1/nodes/deactivate",
|
|
70
|
+
body:,
|
|
71
|
+
**options
|
|
72
|
+
)
|
|
73
|
+
Models::NodeDeactivateResponse.from(res)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by openapi-gen; DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
require_relative "../../core/url"
|
|
6
|
+
require_relative "models.gen"
|
|
7
|
+
|
|
8
|
+
module Unikraft
|
|
9
|
+
module Cloud
|
|
10
|
+
class API
|
|
11
|
+
class ControlPlane
|
|
12
|
+
# Low-level "plumbing" client for the `NodeService` resource of the
|
|
13
|
+
# ControlPlane API. Methods mirror the OpenAPI specification: they are
|
|
14
|
+
# named after the operationId and return the response envelope
|
|
15
|
+
# untouched.
|
|
16
|
+
class NodeServiceApi
|
|
17
|
+
# @return [#request, #bytes, #stream] the transport, usually a
|
|
18
|
+
# {Unikraft::Cloud::Core::ApiClient}
|
|
19
|
+
attr_reader :client
|
|
20
|
+
|
|
21
|
+
# @param client [#request, #bytes, #stream] the transport
|
|
22
|
+
def initialize(client)
|
|
23
|
+
@client = client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Delete Node Nodes
|
|
27
|
+
#
|
|
28
|
+
# `DELETE /v1/nodes`
|
|
29
|
+
#
|
|
30
|
+
# @param force [Boolean, nil] Force deletion even if nodes are in use.
|
|
31
|
+
# @param body [Hash, Array] the request body
|
|
32
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
33
|
+
# @return [Models::DestroyNodeResponse, nil] the response envelope
|
|
34
|
+
# @raise [Unikraft::Cloud::Error]
|
|
35
|
+
def destroy_node(body:, force: nil, **options)
|
|
36
|
+
res = @client.request(
|
|
37
|
+
method: "DELETE",
|
|
38
|
+
path: "/v1/nodes",
|
|
39
|
+
query: {
|
|
40
|
+
force:
|
|
41
|
+
},
|
|
42
|
+
body:,
|
|
43
|
+
**options
|
|
44
|
+
)
|
|
45
|
+
Models::DestroyNodeResponse.from(res)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Delete Node Node by UUID
|
|
49
|
+
#
|
|
50
|
+
# `DELETE /v1/nodes/{uuid}`
|
|
51
|
+
#
|
|
52
|
+
# @param uuid [String] The UUID of the node to delete.
|
|
53
|
+
# @param force [Boolean, nil] Force deletion even if the node is in use.
|
|
54
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
55
|
+
# @return [Models::DestroyNodeResponse, nil] the response envelope
|
|
56
|
+
# @raise [Unikraft::Cloud::Error]
|
|
57
|
+
def destroy_node_by_uuid(uuid:, force: nil, **options)
|
|
58
|
+
res = @client.request(
|
|
59
|
+
method: "DELETE",
|
|
60
|
+
path: "/v1/nodes/#{Core::URL.escape_segment(uuid)}",
|
|
61
|
+
query: {
|
|
62
|
+
force:
|
|
63
|
+
},
|
|
64
|
+
**options
|
|
65
|
+
)
|
|
66
|
+
Models::DestroyNodeResponse.from(res)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Get Node Node by UUID
|
|
70
|
+
#
|
|
71
|
+
# `GET /v1/nodes/{uuid}`
|
|
72
|
+
#
|
|
73
|
+
# @param uuid [String] The UUID of the node to retrieve.
|
|
74
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
75
|
+
# @return [Models::ListNodesResponse, nil] the response envelope
|
|
76
|
+
# @raise [Unikraft::Cloud::Error]
|
|
77
|
+
def get_node_by_uuid(uuid:, **options)
|
|
78
|
+
res = @client.request(
|
|
79
|
+
method: "GET",
|
|
80
|
+
path: "/v1/nodes/#{Core::URL.escape_segment(uuid)}",
|
|
81
|
+
**options
|
|
82
|
+
)
|
|
83
|
+
Models::ListNodesResponse.from(res)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List Machine Types
|
|
87
|
+
#
|
|
88
|
+
# `GET /v1/nodes/providers/{cloudprovider}/types`
|
|
89
|
+
#
|
|
90
|
+
# @param cloudprovider [String] The cloud provider to list machine types for.
|
|
91
|
+
# @param region [String, nil] Optional region filter. Some providers have region-specific availability.
|
|
92
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
93
|
+
# @return [Models::ListMachineTypesResponse, nil] the response envelope
|
|
94
|
+
# @raise [Unikraft::Cloud::Error]
|
|
95
|
+
def list_machine_types(cloudprovider:, region: nil, **options)
|
|
96
|
+
res = @client.request(
|
|
97
|
+
method: "GET",
|
|
98
|
+
path: "/v1/nodes/providers/#{Core::URL.escape_segment(cloudprovider)}/types",
|
|
99
|
+
query: {
|
|
100
|
+
region:
|
|
101
|
+
},
|
|
102
|
+
**options
|
|
103
|
+
)
|
|
104
|
+
Models::ListMachineTypesResponse.from(res)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# List Node Nodes
|
|
108
|
+
#
|
|
109
|
+
# `GET /v1/nodes`
|
|
110
|
+
#
|
|
111
|
+
# @param uuid [Array<String>, nil] The UUID of the resource.
|
|
112
|
+
# @param name [Array<String>, nil] The name of the resource.
|
|
113
|
+
# @param cloudprovider [String, nil] Optional filter by cloud provider.
|
|
114
|
+
# @param state [String, nil] Optional filter by state.
|
|
115
|
+
# @param metro [String, nil] Optional filter by metro.
|
|
116
|
+
# @param limit [Integer, nil] Maximum number of results to return.
|
|
117
|
+
# @param offset [Integer, nil] Offset for pagination.
|
|
118
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
119
|
+
# @return [Models::ListNodesResponse, nil] the response envelope
|
|
120
|
+
# @raise [Unikraft::Cloud::Error]
|
|
121
|
+
def list_nodes(uuid: nil, name: nil, cloudprovider: nil, state: nil, metro: nil, limit: nil, offset: nil, **options)
|
|
122
|
+
res = @client.request(
|
|
123
|
+
method: "GET",
|
|
124
|
+
path: "/v1/nodes",
|
|
125
|
+
query: {
|
|
126
|
+
uuid:,
|
|
127
|
+
name:,
|
|
128
|
+
cloudprovider:,
|
|
129
|
+
state:,
|
|
130
|
+
metro:,
|
|
131
|
+
limit:,
|
|
132
|
+
offset:
|
|
133
|
+
},
|
|
134
|
+
**options
|
|
135
|
+
)
|
|
136
|
+
Models::ListNodesResponse.from(res)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# List Regions
|
|
140
|
+
#
|
|
141
|
+
# `GET /v1/nodes/providers/{cloudprovider}/regions`
|
|
142
|
+
#
|
|
143
|
+
# @param cloudprovider [String] The cloud provider to list regions for.
|
|
144
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
145
|
+
# @return [Models::ListRegionsResponse, nil] the response envelope
|
|
146
|
+
# @raise [Unikraft::Cloud::Error]
|
|
147
|
+
def list_regions(cloudprovider:, **options)
|
|
148
|
+
res = @client.request(
|
|
149
|
+
method: "GET",
|
|
150
|
+
path: "/v1/nodes/providers/#{Core::URL.escape_segment(cloudprovider)}/regions",
|
|
151
|
+
**options
|
|
152
|
+
)
|
|
153
|
+
Models::ListRegionsResponse.from(res)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Create Node Node
|
|
157
|
+
#
|
|
158
|
+
# `POST /v1/nodes`
|
|
159
|
+
#
|
|
160
|
+
# @param body [Models::ProvisionNodeRequest, Hash, Array] the request body
|
|
161
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
162
|
+
# @return [Models::ProvisionNodeResponse, nil] the response envelope
|
|
163
|
+
# @raise [Unikraft::Cloud::Error]
|
|
164
|
+
def provision_node(body:, **options)
|
|
165
|
+
res = @client.request(
|
|
166
|
+
method: "POST",
|
|
167
|
+
path: "/v1/nodes",
|
|
168
|
+
body:,
|
|
169
|
+
**options
|
|
170
|
+
)
|
|
171
|
+
Models::ProvisionNodeResponse.from(res)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Update Node Node by UUID
|
|
175
|
+
#
|
|
176
|
+
# `PATCH /v1/nodes/{uuid}`
|
|
177
|
+
#
|
|
178
|
+
# @param uuid [String] The UUID of the node to update.
|
|
179
|
+
# @param body [Hash, Array] the request body
|
|
180
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
181
|
+
# @return [Models::UpdateNodesResponse, nil] the response envelope
|
|
182
|
+
# @raise [Unikraft::Cloud::Error]
|
|
183
|
+
def update_node_by_uuid(uuid:, body:, **options)
|
|
184
|
+
res = @client.request(
|
|
185
|
+
method: "PATCH",
|
|
186
|
+
path: "/v1/nodes/#{Core::URL.escape_segment(uuid)}",
|
|
187
|
+
body:,
|
|
188
|
+
**options
|
|
189
|
+
)
|
|
190
|
+
Models::UpdateNodesResponse.from(res)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Update Node Nodes
|
|
194
|
+
#
|
|
195
|
+
# `PATCH /v1/nodes`
|
|
196
|
+
#
|
|
197
|
+
# @param property [Array<String>, nil] The property to update.
|
|
198
|
+
# @param operation [Array<String>, nil] The operation to perform on the property.
|
|
199
|
+
# @param value [Array<String>, nil] The value for the update operation. The type depends on the property:
|
|
200
|
+
# - TAGS: google.protobuf.Struct with key-value pairs
|
|
201
|
+
# - DELETE_LOCK: google.protobuf.Value with boolean
|
|
202
|
+
# - SSH_KEYS: google.protobuf.ListValue with SSHKey objects
|
|
203
|
+
# - API_ENDPOINT: the URL as plain text
|
|
204
|
+
# @param body [Hash, Array] the request body
|
|
205
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
206
|
+
# @return [Models::UpdateNodesResponse, nil] the response envelope
|
|
207
|
+
# @raise [Unikraft::Cloud::Error]
|
|
208
|
+
def update_nodes(body:, property: nil, operation: nil, value: nil, **options)
|
|
209
|
+
res = @client.request(
|
|
210
|
+
method: "PATCH",
|
|
211
|
+
path: "/v1/nodes",
|
|
212
|
+
query: {
|
|
213
|
+
property:,
|
|
214
|
+
operation:,
|
|
215
|
+
value:
|
|
216
|
+
},
|
|
217
|
+
body:,
|
|
218
|
+
**options
|
|
219
|
+
)
|
|
220
|
+
Models::UpdateNodesResponse.from(res)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Wait for Node Node State by UUID
|
|
224
|
+
#
|
|
225
|
+
# `GET /v1/nodes/{uuid}/wait`
|
|
226
|
+
#
|
|
227
|
+
# @param uuid [String] The UUID of the node to wait for.
|
|
228
|
+
# @param states [Array<String>, nil] The desired state(s) to wait for. The request completes when any of
|
|
229
|
+
# these states is reached.
|
|
230
|
+
# @param timeout_ms [Integer, nil] Timeout in milliseconds. Use -1 for infinite wait.
|
|
231
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
232
|
+
# @return [Models::WaitNodesResponse, nil] the response envelope
|
|
233
|
+
# @raise [Unikraft::Cloud::Error]
|
|
234
|
+
def wait_node_by_uuid(uuid:, states: nil, timeout_ms: nil, **options)
|
|
235
|
+
res = @client.request(
|
|
236
|
+
method: "GET",
|
|
237
|
+
path: "/v1/nodes/#{Core::URL.escape_segment(uuid)}/wait",
|
|
238
|
+
query: {
|
|
239
|
+
states:,
|
|
240
|
+
timeout_ms:
|
|
241
|
+
},
|
|
242
|
+
**options
|
|
243
|
+
)
|
|
244
|
+
Models::WaitNodesResponse.from(res)
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Wait for Node Nodes States
|
|
248
|
+
#
|
|
249
|
+
# `GET /v1/nodes/wait`
|
|
250
|
+
#
|
|
251
|
+
# @param uuid [Array<String>, nil] The UUID of the resource.
|
|
252
|
+
# @param name [Array<String>, nil] The name of the resource.
|
|
253
|
+
# @param states [Array<String>, nil] The desired state(s) to wait for.
|
|
254
|
+
# @param timeout_ms [Integer, nil] Timeout in milliseconds. Use -1 for infinite wait.
|
|
255
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
256
|
+
# @return [Models::WaitNodesResponse, nil] the response envelope
|
|
257
|
+
# @raise [Unikraft::Cloud::Error]
|
|
258
|
+
def wait_nodes(uuid: nil, name: nil, states: nil, timeout_ms: nil, **options)
|
|
259
|
+
res = @client.request(
|
|
260
|
+
method: "GET",
|
|
261
|
+
path: "/v1/nodes/wait",
|
|
262
|
+
query: {
|
|
263
|
+
uuid:,
|
|
264
|
+
name:,
|
|
265
|
+
states:,
|
|
266
|
+
timeout_ms:
|
|
267
|
+
},
|
|
268
|
+
**options
|
|
269
|
+
)
|
|
270
|
+
Models::WaitNodesResponse.from(res)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by openapi-gen; DO NOT EDIT.
|
|
4
|
+
#
|
|
5
|
+
# Loads every generated client of the ControlPlane API.
|
|
6
|
+
|
|
7
|
+
require_relative "models.gen"
|
|
8
|
+
require_relative "auth.gen"
|
|
9
|
+
require_relative "images.gen"
|
|
10
|
+
require_relative "metros.gen"
|
|
11
|
+
require_relative "node_activation_service.gen"
|
|
12
|
+
require_relative "node_service.gen"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
4
|
+
# Copyright (c) 2026, Unikraft GmbH.
|
|
5
|
+
|
|
6
|
+
require_relative "../core/http"
|
|
7
|
+
require_relative "controlplane/resources.gen"
|
|
8
|
+
|
|
9
|
+
module Unikraft
|
|
10
|
+
module Cloud
|
|
11
|
+
class API
|
|
12
|
+
# Every control-plane API resource, raw. The control plane is global:
|
|
13
|
+
# it lists metros, checks credentials and manages nodes.
|
|
14
|
+
#
|
|
15
|
+
# @example
|
|
16
|
+
# api = Unikraft::Cloud::API::ControlPlane.new(
|
|
17
|
+
# base_url: "https://api.unikraft.cloud", token: ENV["UKC_TOKEN"]
|
|
18
|
+
# )
|
|
19
|
+
# api.metros.list_metros.data.metros
|
|
20
|
+
class ControlPlane
|
|
21
|
+
# @return [#request, #bytes, #stream] the shared transport
|
|
22
|
+
attr_reader :client
|
|
23
|
+
# @return [AuthApi] authorization checks and sign-in
|
|
24
|
+
attr_reader :auth
|
|
25
|
+
# @return [ImagesApi] the global image registry
|
|
26
|
+
attr_reader :images
|
|
27
|
+
# @return [MetrosApi] the metros the account can reach
|
|
28
|
+
attr_reader :metros
|
|
29
|
+
# @return [NodeServiceApi] nodes
|
|
30
|
+
attr_reader :nodes
|
|
31
|
+
# @return [NodeActivationServiceApi] node activation and renewal
|
|
32
|
+
attr_reader :node_activation
|
|
33
|
+
|
|
34
|
+
# @param client [#request, #bytes, #stream, nil] a transport to share;
|
|
35
|
+
# when nil, one is built from `config`
|
|
36
|
+
# @param config [Hash] {Core::ApiClient#initialize} keywords, e.g.
|
|
37
|
+
# `base_url:` and `token:`
|
|
38
|
+
def initialize(client = nil, **config)
|
|
39
|
+
@client = client || Core::ApiClient.new(**config)
|
|
40
|
+
@auth = AuthApi.new(@client)
|
|
41
|
+
@images = ImagesApi.new(@client)
|
|
42
|
+
@metros = MetrosApi.new(@client)
|
|
43
|
+
@nodes = NodeServiceApi.new(@client)
|
|
44
|
+
@node_activation = NodeActivationServiceApi.new(@client)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by openapi-gen; DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
require_relative "../../core/url"
|
|
6
|
+
require_relative "models.gen"
|
|
7
|
+
|
|
8
|
+
module Unikraft
|
|
9
|
+
module Cloud
|
|
10
|
+
class API
|
|
11
|
+
class Platform
|
|
12
|
+
# Low-level "plumbing" client for the `audit` resource of the
|
|
13
|
+
# Platform API. Methods mirror the OpenAPI specification: they are
|
|
14
|
+
# named after the operationId and return the response envelope
|
|
15
|
+
# untouched.
|
|
16
|
+
class AuditApi
|
|
17
|
+
# @return [#request, #bytes, #stream] the transport, usually a
|
|
18
|
+
# {Unikraft::Cloud::Core::ApiClient}
|
|
19
|
+
attr_reader :client
|
|
20
|
+
|
|
21
|
+
# @param client [#request, #bytes, #stream] the transport
|
|
22
|
+
def initialize(client)
|
|
23
|
+
@client = client
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Subscribe to Audit Events
|
|
27
|
+
#
|
|
28
|
+
# `GET /v1/audit`
|
|
29
|
+
#
|
|
30
|
+
# @param events [Array<String>, nil] Deliver only these event types.
|
|
31
|
+
# @param uuid [Array<String>, nil] Deliver only events about these object UUIDs.
|
|
32
|
+
# @param tags [Array<String>, nil] Deliver only events about objects carrying all of these tags.
|
|
33
|
+
# @param options [Hash] per-call `headers:`, `base_url:` and `timeout:`
|
|
34
|
+
# @yieldparam event [Models::AuditEvent] each event, as it arrives
|
|
35
|
+
# @return [Enumerator, nil] an Enumerator when no block is given
|
|
36
|
+
# @raise [Unikraft::Cloud::Error]
|
|
37
|
+
def subscribe_audit_events(events: nil, uuid: nil, tags: nil, **options, &block)
|
|
38
|
+
return enum_for(__method__, events:, uuid:, tags:, **options) unless block
|
|
39
|
+
|
|
40
|
+
@client.stream(
|
|
41
|
+
method: "GET",
|
|
42
|
+
path: "/v1/audit",
|
|
43
|
+
query: {
|
|
44
|
+
events: events&.join(","),
|
|
45
|
+
uuid: uuid&.join(","),
|
|
46
|
+
tags: tags&.join(",")
|
|
47
|
+
},
|
|
48
|
+
**options
|
|
49
|
+
) { |event| yield Models::AuditEvent.from(event) }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|