daytona 0.193.0 → 0.194.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 +4 -4
- data/lib/daytona/common/response.rb +24 -0
- data/lib/daytona/file_system.rb +11 -2
- data/lib/daytona/git.rb +232 -6
- data/lib/daytona/sdk/version.rb +1 -1
- data/lib/daytona/secret_service.rb +28 -4
- data/scripts/generate-docs.rb +10 -4
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52e589fc8beb1606bed33e09a6caabe834daf349ec5042e36332eaee4bd23544
|
|
4
|
+
data.tar.gz: ffe431dbab005054179308e74c1b1c5d406f34925f096f01be7bf75e9a149b59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73d0b98ed2a79fbaafd27f5e49a12a78f3289e37d15bf512a6f99b37b5e0d3a1da44fb5b322fc4abd8226598e152372ba53b91335bfdcb1d1fa84416eace7294
|
|
7
|
+
data.tar.gz: e8244a2e9dd9f7737af789ab7855cbb2eee625f0774cbe34d845955195b3f9cc2e80c44872c468b7c29a595582f45faaddb32a1ca4ec8da2b6ae3e8441297822
|
|
@@ -37,6 +37,30 @@ module Daytona
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# Cursor-paginated collection of Secrets returned by
|
|
41
|
+
# {Daytona::SecretService#list}. Pass +next_cursor+ back as the
|
|
42
|
+
# +cursor+ of the next call to fetch the following page; it is +nil+ when
|
|
43
|
+
# there are no more pages.
|
|
44
|
+
class ListSecretsResponse
|
|
45
|
+
# @return [Array<Daytona::Secret>]
|
|
46
|
+
attr_reader :items
|
|
47
|
+
|
|
48
|
+
# @return [Float]
|
|
49
|
+
attr_reader :total
|
|
50
|
+
|
|
51
|
+
# @return [String, nil]
|
|
52
|
+
attr_reader :next_cursor
|
|
53
|
+
|
|
54
|
+
# @param items [Array<Daytona::Secret>]
|
|
55
|
+
# @param total [Float]
|
|
56
|
+
# @param next_cursor [String, nil]
|
|
57
|
+
def initialize(items:, total:, next_cursor:)
|
|
58
|
+
@items = items
|
|
59
|
+
@total = total
|
|
60
|
+
@next_cursor = next_cursor
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
40
64
|
# Query parameters for filtering and sorting when listing Sandboxes.
|
|
41
65
|
#
|
|
42
66
|
# All fields are optional and default to +nil+. Constructed via keyword
|
data/lib/daytona/file_system.rb
CHANGED
|
@@ -97,6 +97,9 @@ module Daytona
|
|
|
97
97
|
#
|
|
98
98
|
# @param path [String] Path to the directory to list contents from. Relative paths are resolved
|
|
99
99
|
# based on the sandbox working directory.
|
|
100
|
+
# @param depth [Integer, nil] How many levels deep to list. depth=1 (default) lists the
|
|
101
|
+
# directory's entries, depth=2 also includes their children, and so on. Must be >= 1.
|
|
102
|
+
# Each returned FileInfo carries a full path field.
|
|
100
103
|
# @return [Array<DaytonaApiClient::FileInfo>] List of file and directory information
|
|
101
104
|
# @raise [Daytona::Sdk::Error] If the operation fails
|
|
102
105
|
#
|
|
@@ -112,8 +115,14 @@ module Daytona
|
|
|
112
115
|
# # List only directories
|
|
113
116
|
# dirs = files.select(&:is_dir)
|
|
114
117
|
# puts "Subdirectories: #{dirs.map(&:name).join(', ')}"
|
|
115
|
-
def list_files(path)
|
|
116
|
-
|
|
118
|
+
def list_files(path, depth: nil)
|
|
119
|
+
if !depth.nil? && (!depth.is_a?(Integer) || depth < 1)
|
|
120
|
+
raise Sdk::Error, 'Failed to list files: depth must be an integer of at least 1'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
toolbox_api.list_files({ path:, depth: }.compact)
|
|
124
|
+
rescue Sdk::Error
|
|
125
|
+
raise
|
|
117
126
|
rescue StandardError => e
|
|
118
127
|
raise Sdk::Error, "Failed to list files: #{e.message}"
|
|
119
128
|
end
|
data/lib/daytona/git.rb
CHANGED
|
@@ -85,6 +85,7 @@ module Daytona
|
|
|
85
85
|
# @param insecure_skip_tls [Boolean, nil] Skip TLS certificate verification (insecure).
|
|
86
86
|
# Use only for trusted internal Git servers with self-signed or private-CA certs;
|
|
87
87
|
# credentials, if supplied, are transmitted over an unverified TLS connection.
|
|
88
|
+
# @param depth [Integer, nil] Create a shallow clone truncated to the given number of commits.
|
|
88
89
|
# @return [void]
|
|
89
90
|
# @raise [Daytona::Sdk::Error] if cloning repository fails
|
|
90
91
|
#
|
|
@@ -110,7 +111,7 @@ module Daytona
|
|
|
110
111
|
# path: "workspace/repo-old",
|
|
111
112
|
# commit_id: "abc123"
|
|
112
113
|
# )
|
|
113
|
-
def clone(url:, path:, branch: nil, commit_id: nil, username: nil, password: nil, insecure_skip_tls: nil) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
|
|
114
|
+
def clone(url:, path:, branch: nil, commit_id: nil, username: nil, password: nil, insecure_skip_tls: nil, depth: nil) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Layout/LineLength
|
|
114
115
|
toolbox_api.clone_repository(
|
|
115
116
|
DaytonaToolboxApiClient::GitCloneRequest.new(
|
|
116
117
|
url: url,
|
|
@@ -119,7 +120,8 @@ module Daytona
|
|
|
119
120
|
username: username,
|
|
120
121
|
password: password,
|
|
121
122
|
commit_id: commit_id,
|
|
122
|
-
insecure_skip_tls: insecure_skip_tls
|
|
123
|
+
insecure_skip_tls: insecure_skip_tls,
|
|
124
|
+
depth: depth
|
|
123
125
|
)
|
|
124
126
|
)
|
|
125
127
|
rescue DaytonaToolboxApiClient::ApiError => e
|
|
@@ -170,6 +172,9 @@ module Daytona
|
|
|
170
172
|
# the sandbox working directory.
|
|
171
173
|
# @param username [String, nil] Git username for authentication.
|
|
172
174
|
# @param password [String, nil] Git password or token for authentication.
|
|
175
|
+
# @param branch [String, nil] Branch to push. Defaults to the current branch.
|
|
176
|
+
# @param remote [String, nil] Remote to push to. Defaults to "origin".
|
|
177
|
+
# @param set_upstream [Boolean] Record the pushed branch as the upstream tracking branch. Defaults to false.
|
|
173
178
|
# @return [void]
|
|
174
179
|
# @raise [Daytona::Sdk::Error] if pushing changes fails
|
|
175
180
|
#
|
|
@@ -183,9 +188,12 @@ module Daytona
|
|
|
183
188
|
# username: "user",
|
|
184
189
|
# password: "github_token"
|
|
185
190
|
# )
|
|
186
|
-
|
|
191
|
+
#
|
|
192
|
+
# # Push a new branch and set its upstream
|
|
193
|
+
# sandbox.git.push(path: "workspace/repo", branch: "feature", set_upstream: true)
|
|
194
|
+
def push(path:, username: nil, password: nil, branch: nil, remote: nil, set_upstream: false) # rubocop:disable Metrics/ParameterLists
|
|
187
195
|
toolbox_api.push_changes(
|
|
188
|
-
DaytonaToolboxApiClient::
|
|
196
|
+
DaytonaToolboxApiClient::GitPushRequest.new(path:, username:, password:, branch:, remote:, set_upstream:)
|
|
189
197
|
)
|
|
190
198
|
rescue DaytonaToolboxApiClient::ApiError => e
|
|
191
199
|
raise map_api_error(e, 'Failed to push changes')
|
|
@@ -200,6 +208,8 @@ module Daytona
|
|
|
200
208
|
# the sandbox working directory.
|
|
201
209
|
# @param username [String, nil] Git username for authentication.
|
|
202
210
|
# @param password [String, nil] Git password or token for authentication.
|
|
211
|
+
# @param branch [String, nil] Branch to pull. Defaults to the current branch's upstream.
|
|
212
|
+
# @param remote [String, nil] Remote to pull from. Defaults to "origin".
|
|
203
213
|
# @return [void]
|
|
204
214
|
# @raise [Daytona::Sdk::Error] if pulling changes fails
|
|
205
215
|
#
|
|
@@ -214,9 +224,11 @@ module Daytona
|
|
|
214
224
|
# password: "github_token"
|
|
215
225
|
# )
|
|
216
226
|
#
|
|
217
|
-
|
|
227
|
+
# # Pull a specific branch from a specific remote
|
|
228
|
+
# sandbox.git.pull(path: "workspace/repo", remote: "upstream", branch: "main")
|
|
229
|
+
def pull(path:, username: nil, password: nil, branch: nil, remote: nil)
|
|
218
230
|
toolbox_api.pull_changes(
|
|
219
|
-
DaytonaToolboxApiClient::
|
|
231
|
+
DaytonaToolboxApiClient::GitPullRequest.new(path:, username:, password:, branch:, remote:)
|
|
220
232
|
)
|
|
221
233
|
rescue DaytonaToolboxApiClient::ApiError => e
|
|
222
234
|
raise map_api_error(e, 'Failed to pull changes')
|
|
@@ -308,8 +320,222 @@ module Daytona
|
|
|
308
320
|
raise Sdk::Error, "Failed to delete branch: #{e.message}"
|
|
309
321
|
end
|
|
310
322
|
|
|
323
|
+
# Initializes a new Git repository at the specified path.
|
|
324
|
+
#
|
|
325
|
+
# @param path [String] Path where the repository should be initialized.
|
|
326
|
+
# @param bare [Boolean] Create a bare repository without a working tree. Defaults to false.
|
|
327
|
+
# @param initial_branch [String, nil] Name of the initial branch. If not specified, uses the Git default.
|
|
328
|
+
# @return [void]
|
|
329
|
+
# @raise [Daytona::Sdk::Error] if initializing repository fails
|
|
330
|
+
#
|
|
331
|
+
# @example
|
|
332
|
+
# sandbox.git.init("workspace/repo", initial_branch: "main")
|
|
333
|
+
def init(path, bare: false, initial_branch: nil)
|
|
334
|
+
toolbox_api.init_repository(
|
|
335
|
+
DaytonaToolboxApiClient::GitInitRequest.new(path:, bare:, initial_branch:)
|
|
336
|
+
)
|
|
337
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
338
|
+
raise map_api_error(e, 'Failed to initialize repository')
|
|
339
|
+
rescue StandardError => e
|
|
340
|
+
raise Sdk::Error, "Failed to initialize repository: #{e.message}"
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Resets the current HEAD to the specified state.
|
|
344
|
+
#
|
|
345
|
+
# @param path [String] Path to the Git repository root.
|
|
346
|
+
# @param mode [String, nil] Reset mode, one of "soft", "mixed" (default), "hard", "merge" or "keep".
|
|
347
|
+
# @param target [String, nil] Revision to reset to. Defaults to HEAD.
|
|
348
|
+
# @param files [Array<String>, nil] Constrain the reset to the given paths.
|
|
349
|
+
# @return [void]
|
|
350
|
+
# @raise [Daytona::Sdk::Error] if resetting fails
|
|
351
|
+
#
|
|
352
|
+
# @example
|
|
353
|
+
# # Unstage all changes (mixed reset to HEAD)
|
|
354
|
+
# sandbox.git.reset("workspace/repo")
|
|
355
|
+
#
|
|
356
|
+
# # Hard reset to a previous commit
|
|
357
|
+
# sandbox.git.reset("workspace/repo", mode: "hard", target: "HEAD~1")
|
|
358
|
+
def reset(path, mode: nil, target: nil, files: nil)
|
|
359
|
+
toolbox_api.reset_changes(
|
|
360
|
+
DaytonaToolboxApiClient::GitResetRequest.new(path:, mode:, target:, files:)
|
|
361
|
+
)
|
|
362
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
363
|
+
raise map_api_error(e, 'Failed to reset')
|
|
364
|
+
rescue StandardError => e
|
|
365
|
+
raise Sdk::Error, "Failed to reset: #{e.message}"
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Restores working tree files or unstages changes.
|
|
369
|
+
#
|
|
370
|
+
# @param path [String] Path to the Git repository root.
|
|
371
|
+
# @param files [Array<String>] File paths to restore.
|
|
372
|
+
# @param staged [Boolean, nil] Restore the staging index for the given files.
|
|
373
|
+
# @param worktree [Boolean, nil] Restore the working tree for the given files. Defaults to true
|
|
374
|
+
# when neither staged nor worktree is provided.
|
|
375
|
+
# @param source [String, nil] Restore file contents from the given revision instead of the index.
|
|
376
|
+
# @return [void]
|
|
377
|
+
# @raise [Daytona::Sdk::Error] if restoring fails
|
|
378
|
+
#
|
|
379
|
+
# @example
|
|
380
|
+
# # Discard working tree changes
|
|
381
|
+
# sandbox.git.restore("workspace/repo", ["file.txt"])
|
|
382
|
+
#
|
|
383
|
+
# # Unstage changes
|
|
384
|
+
# sandbox.git.restore("workspace/repo", ["file.txt"], staged: true)
|
|
385
|
+
def restore(path, files, staged: nil, worktree: nil, source: nil)
|
|
386
|
+
toolbox_api.restore_files(
|
|
387
|
+
DaytonaToolboxApiClient::GitRestoreRequest.new(path:, files:, staged:, worktree:, source:)
|
|
388
|
+
)
|
|
389
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
390
|
+
raise map_api_error(e, 'Failed to restore files')
|
|
391
|
+
rescue StandardError => e
|
|
392
|
+
raise Sdk::Error, "Failed to restore files: #{e.message}"
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
# Adds (or overwrites) a remote in the repository.
|
|
396
|
+
#
|
|
397
|
+
# @param path [String] Path to the Git repository root.
|
|
398
|
+
# @param name [String] Name of the remote.
|
|
399
|
+
# @param url [String] URL of the remote.
|
|
400
|
+
# @param fetch [Boolean] Fetch from the remote immediately after adding it. Defaults to false.
|
|
401
|
+
# @param overwrite [Boolean] Replace an existing remote with the same name. Defaults to false.
|
|
402
|
+
# @return [void]
|
|
403
|
+
# @raise [Daytona::Sdk::Error] if adding the remote fails
|
|
404
|
+
#
|
|
405
|
+
# @example
|
|
406
|
+
# sandbox.git.remote_add("workspace/repo", "origin", "https://github.com/user/repo.git")
|
|
407
|
+
def remote_add(path, name, url, fetch: false, overwrite: false)
|
|
408
|
+
toolbox_api.add_remote(
|
|
409
|
+
DaytonaToolboxApiClient::GitAddRemoteRequest.new(path:, name:, url:, fetch:, overwrite:)
|
|
410
|
+
)
|
|
411
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
412
|
+
raise map_api_error(e, 'Failed to add remote')
|
|
413
|
+
rescue StandardError => e
|
|
414
|
+
raise Sdk::Error, "Failed to add remote: #{e.message}"
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
# Lists the remotes configured in the repository.
|
|
418
|
+
#
|
|
419
|
+
# @param path [String] Path to the Git repository root.
|
|
420
|
+
# @return [DaytonaToolboxApiClient::ListRemotesResponse] The configured remotes (name + URL).
|
|
421
|
+
# @raise [Daytona::Sdk::Error] if listing remotes fails
|
|
422
|
+
#
|
|
423
|
+
# @example
|
|
424
|
+
# response = sandbox.git.remotes("workspace/repo")
|
|
425
|
+
# response.remotes.each { |r| puts "#{r.name}: #{r.url}" }
|
|
426
|
+
def remotes(path)
|
|
427
|
+
toolbox_api.list_remotes(path)
|
|
428
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
429
|
+
raise map_api_error(e, 'Failed to list remotes')
|
|
430
|
+
rescue StandardError => e
|
|
431
|
+
raise Sdk::Error, "Failed to list remotes: #{e.message}"
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# Gets the URL of a remote, or nil when it does not exist.
|
|
435
|
+
#
|
|
436
|
+
# @param path [String] Path to the Git repository root.
|
|
437
|
+
# @param name [String] Name of the remote.
|
|
438
|
+
# @return [String, nil] The remote URL, or nil when the remote does not exist.
|
|
439
|
+
# @raise [Daytona::Sdk::Error] if getting the remote fails
|
|
440
|
+
#
|
|
441
|
+
# @example
|
|
442
|
+
# url = sandbox.git.remote_get("workspace/repo", "origin")
|
|
443
|
+
def remote_get(path, name)
|
|
444
|
+
toolbox_api.list_remotes(path).remotes.find { |r| r.name == name }&.url
|
|
445
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
446
|
+
raise map_api_error(e, 'Failed to get remote')
|
|
447
|
+
rescue StandardError => e
|
|
448
|
+
raise Sdk::Error, "Failed to get remote: #{e.message}"
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# Sets a Git config value at the given scope.
|
|
452
|
+
#
|
|
453
|
+
# @param key [String] Config key in dotted form (e.g. "user.name").
|
|
454
|
+
# @param value [String] Config value.
|
|
455
|
+
# @param scope [String] Config scope, one of "global" (default), "local" or "system".
|
|
456
|
+
# @param path [String, nil] Repository path, required when scope is "local".
|
|
457
|
+
# @return [void]
|
|
458
|
+
# @raise [Daytona::Sdk::Error] if setting config fails
|
|
459
|
+
#
|
|
460
|
+
# @example
|
|
461
|
+
# sandbox.git.set_config("user.name", "John Doe")
|
|
462
|
+
def set_config(key, value, scope: 'global', path: nil)
|
|
463
|
+
toolbox_api.set_git_config(
|
|
464
|
+
DaytonaToolboxApiClient::GitSetConfigRequest.new(key:, value:, scope:, path:)
|
|
465
|
+
)
|
|
466
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
467
|
+
raise map_api_error(e, 'Failed to set config')
|
|
468
|
+
rescue StandardError => e
|
|
469
|
+
raise Sdk::Error, "Failed to set config: #{e.message}"
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
# Gets a Git config value at the given scope, or nil when unset.
|
|
473
|
+
#
|
|
474
|
+
# @param key [String] Config key in dotted form (e.g. "user.name").
|
|
475
|
+
# @param scope [String] Config scope, one of "global" (default), "local" or "system".
|
|
476
|
+
# @param path [String, nil] Repository path, required when scope is "local".
|
|
477
|
+
# @return [String, nil] The config value, or nil when the key is not set.
|
|
478
|
+
# @raise [Daytona::Sdk::Error] if getting config fails
|
|
479
|
+
#
|
|
480
|
+
# @example
|
|
481
|
+
# name = sandbox.git.get_config("user.name")
|
|
482
|
+
def get_config(key, scope: 'global', path: nil)
|
|
483
|
+
toolbox_api.get_git_config(key, scope: scope, path: path).value
|
|
484
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
485
|
+
raise map_api_error(e, 'Failed to get config')
|
|
486
|
+
rescue StandardError => e
|
|
487
|
+
raise Sdk::Error, "Failed to get config: #{e.message}"
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
# Configures the Git user name and email at the given scope.
|
|
491
|
+
#
|
|
492
|
+
# @param name [String] User name (user.name).
|
|
493
|
+
# @param email [String] User email (user.email).
|
|
494
|
+
# @param scope [String] Config scope, one of "global" (default), "local" or "system".
|
|
495
|
+
# @param path [String, nil] Repository path, required when scope is "local".
|
|
496
|
+
# @return [void]
|
|
497
|
+
# @raise [Daytona::Sdk::Error] if configuring user fails
|
|
498
|
+
#
|
|
499
|
+
# @example
|
|
500
|
+
# sandbox.git.configure_user("John Doe", "john@example.com")
|
|
501
|
+
def configure_user(name, email, scope: 'global', path: nil)
|
|
502
|
+
toolbox_api.configure_user(
|
|
503
|
+
DaytonaToolboxApiClient::GitConfigureUserRequest.new(name:, email:, scope:, path:)
|
|
504
|
+
)
|
|
505
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
506
|
+
raise map_api_error(e, 'Failed to configure user')
|
|
507
|
+
rescue StandardError => e
|
|
508
|
+
raise Sdk::Error, "Failed to configure user: #{e.message}"
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
# Persists Git credentials globally so that subsequent operations against the
|
|
512
|
+
# given host authenticate automatically.
|
|
513
|
+
#
|
|
514
|
+
# WARNING: This stores the password in plaintext on disk via the Git credential store.
|
|
515
|
+
#
|
|
516
|
+
# @param username [String] Git username.
|
|
517
|
+
# @param password [String] Git password or token.
|
|
518
|
+
# @param host [String, nil] Host to authenticate against. Defaults to "github.com".
|
|
519
|
+
# @param protocol [String, nil] Protocol to authenticate against. Defaults to "https".
|
|
520
|
+
# @return [void]
|
|
521
|
+
# @raise [Daytona::Sdk::Error] if authenticating fails
|
|
522
|
+
#
|
|
523
|
+
# @example
|
|
524
|
+
# sandbox.git.dangerously_authenticate("user", "github_token")
|
|
525
|
+
def dangerously_authenticate(username, password, host: nil, protocol: nil)
|
|
526
|
+
toolbox_api.authenticate(
|
|
527
|
+
DaytonaToolboxApiClient::GitAuthenticateRequest.new(username:, password:, host:, protocol:)
|
|
528
|
+
)
|
|
529
|
+
rescue DaytonaToolboxApiClient::ApiError => e
|
|
530
|
+
raise map_api_error(e, 'Failed to authenticate')
|
|
531
|
+
rescue StandardError => e
|
|
532
|
+
raise Sdk::Error, "Failed to authenticate: #{e.message}"
|
|
533
|
+
end
|
|
534
|
+
|
|
311
535
|
instrument :add, :branches, :clone, :commit, :push, :pull, :status,
|
|
312
536
|
:checkout_branch, :create_branch, :delete_branch,
|
|
537
|
+
:init, :reset, :restore, :remote_add, :remotes, :remote_get,
|
|
538
|
+
:set_config, :get_config, :configure_user, :dangerously_authenticate,
|
|
313
539
|
component: 'Git'
|
|
314
540
|
|
|
315
541
|
private
|
data/lib/daytona/sdk/version.rb
CHANGED
|
@@ -50,11 +50,35 @@ module Daytona
|
|
|
50
50
|
# @raise [DaytonaApiClient::ApiError] If no Secret with the given ID exists (404).
|
|
51
51
|
def get(secret_id) = Secret.new(secret_api.get_secret(secret_id))
|
|
52
52
|
|
|
53
|
-
# List
|
|
53
|
+
# List Secrets with cursor-based pagination.
|
|
54
54
|
#
|
|
55
|
-
# @
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
# @param cursor [String, nil] Pagination cursor from a previous response.
|
|
56
|
+
# @param limit [Integer, nil] Number of results per page (1-200, defaults to 100).
|
|
57
|
+
# @param name [String, nil] Filter by partial name match.
|
|
58
|
+
# @param sort [String, nil] Field to sort by: +name+, +createdAt+ or +updatedAt+
|
|
59
|
+
# (defaults to +createdAt+).
|
|
60
|
+
# @param order [String, nil] Direction to sort by: +asc+ or +desc+ (defaults to +desc+).
|
|
61
|
+
# @return [Daytona::ListSecretsResponse]
|
|
62
|
+
# @raise [Daytona::Sdk::Error]
|
|
63
|
+
#
|
|
64
|
+
# @example
|
|
65
|
+
# daytona = Daytona::Daytona.new
|
|
66
|
+
# cursor = nil
|
|
67
|
+
# loop do
|
|
68
|
+
# page = daytona.secret.list(cursor:, limit: 100)
|
|
69
|
+
# page.items.each { |secret| puts secret.name }
|
|
70
|
+
# cursor = page.next_cursor
|
|
71
|
+
# break if cursor.nil?
|
|
72
|
+
# end
|
|
73
|
+
def list(cursor: nil, limit: nil, name: nil, sort: nil, order: nil)
|
|
74
|
+
raise Sdk::Error, 'limit must be positive integer' if limit && limit < 1
|
|
75
|
+
|
|
76
|
+
response = secret_api.list_secrets_paginated(cursor:, limit:, name:, sort:, order:)
|
|
77
|
+
ListSecretsResponse.new(
|
|
78
|
+
items: response.items.map { |secret| Secret.new(secret) },
|
|
79
|
+
total: response.total,
|
|
80
|
+
next_cursor: response.next_cursor
|
|
81
|
+
)
|
|
58
82
|
end
|
|
59
83
|
|
|
60
84
|
# Update a Secret.
|
data/scripts/generate-docs.rb
CHANGED
|
@@ -50,6 +50,14 @@ def add_frontmatter(content, class_name)
|
|
|
50
50
|
frontmatter + content
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
def format_signature_params(parameters)
|
|
54
|
+
parameters.map do |name, default|
|
|
55
|
+
next name if default.nil?
|
|
56
|
+
|
|
57
|
+
name.end_with?(':') ? "#{name} #{default}" : "#{name} = #{default}"
|
|
58
|
+
end.join(', ')
|
|
59
|
+
end
|
|
60
|
+
|
|
53
61
|
def format_type(types)
|
|
54
62
|
return 'Object' if types.nil? || types.empty?
|
|
55
63
|
|
|
@@ -176,8 +184,7 @@ def generate_markdown_for_object(obj)
|
|
|
176
184
|
|
|
177
185
|
# Method signature
|
|
178
186
|
content << '```ruby'
|
|
179
|
-
|
|
180
|
-
content << "def initialize(#{params_str})"
|
|
187
|
+
content << "def initialize(#{format_signature_params(constructor.parameters)})"
|
|
181
188
|
content << '```'
|
|
182
189
|
content << ''
|
|
183
190
|
|
|
@@ -245,8 +252,7 @@ def generate_markdown_for_object(obj)
|
|
|
245
252
|
|
|
246
253
|
# Method signature
|
|
247
254
|
content << '```ruby'
|
|
248
|
-
|
|
249
|
-
content << "def #{method.name}(#{params_str})"
|
|
255
|
+
content << "def #{method.name}(#{format_signature_params(method.parameters)})"
|
|
250
256
|
content << '```'
|
|
251
257
|
content << ''
|
|
252
258
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: daytona
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.194.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daytona Platforms Inc.
|
|
@@ -85,28 +85,28 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - '='
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 0.
|
|
88
|
+
version: 0.194.0
|
|
89
89
|
type: :runtime
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - '='
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.
|
|
95
|
+
version: 0.194.0
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: daytona_toolbox_api_client
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
100
|
- - '='
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 0.
|
|
102
|
+
version: 0.194.0
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - '='
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: 0.
|
|
109
|
+
version: 0.194.0
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
111
|
name: dotenv
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|