daytona 0.191.0 → 0.192.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57a2b331fa8cb901faa0029d2654c95409bb251fe3340d2d33e20503584d5d1e
4
- data.tar.gz: 00a6a3ac444575ac68b69ea471d122d199f02709b47fae4455626f6aa0291c6c
3
+ metadata.gz: 1a7719df0000f634d12b17d3972dec44ef3531ffe9e7c39fb23cd46d99aaae7a
4
+ data.tar.gz: 8bf5cacb5248da7f5b064000c813325b8baaa62972b7d781d43ebf9c60fb536b
5
5
  SHA512:
6
- metadata.gz: 5ff5004f92d21f9be8add806f3db4e482986d6607bd1a6c300181fa6d4b854efd06c0874ec7f33326c2f49ce791c060359567efc9b96067ba1075b71ad8dbf64
7
- data.tar.gz: d0f5684a55b0472042eb0a3be36f8de3517a1a386f532c3c6e64b52dfe647f6d76159a8e83d97b8ebd87b7b5437bde93d5909576668258573dbfcc13be72813f
6
+ metadata.gz: 69531535c5108ecb66a1d5e21263cf327b8d1e51d84958c53d7b0697a7d9f1e4f9056415a1bd1b1d90445551168e2bd7776a124540d4d763fa0bf85cab7f18be
7
+ data.tar.gz: 2699a97602979c2f678aacb6f6c49f26013513c4816edb870444ddeb3c4464c0917fc651fd573babefa1e58347cfc16665e83b4b061a07b364821e6ad235c827
@@ -37,6 +37,11 @@ module Daytona
37
37
  # @return [Array<DaytonaApiClient::SandboxVolume>, nil] List of volumes mounts to attach to the Sandbox
38
38
  attr_accessor :volumes
39
39
 
40
+ # @return [Hash<String, String>, nil] Organization Secrets to expose in the Sandbox, as a mapping
41
+ # of env var name to existing Secret name. The injected env var holds an opaque placeholder that
42
+ # is resolved to the real value only for the Secret's allowed hosts.
43
+ attr_accessor :secrets
44
+
40
45
  # @return [Boolean, nil] Whether to block all network access for the Sandbox
41
46
  attr_accessor :network_block_all
42
47
 
@@ -67,6 +72,8 @@ module Daytona
67
72
  # @param auto_archive_interval [Integer, nil] Auto-archive interval in minutes
68
73
  # @param auto_delete_interval [Integer, nil] Auto-delete interval in minutes
69
74
  # @param volumes [Array<DaytonaApiClient::SandboxVolume>, nil] List of volumes mounts to attach to the Sandbox
75
+ # @param secrets [Hash<String, String>, nil] Organization Secrets to expose in the Sandbox, as a
76
+ # mapping of env var name to existing Secret name
70
77
  # @param network_block_all [Boolean, nil] Whether to block all network access for the Sandbox
71
78
  # @param network_allow_list [String, nil] Comma-separated list of allowed CIDR network addresses for the Sandbox
72
79
  # @param domain_allow_list [String, nil] Comma-separated list of allowed domains for the Sandbox
@@ -83,6 +90,7 @@ module Daytona
83
90
  auto_archive_interval: nil,
84
91
  auto_delete_interval: nil,
85
92
  volumes: nil,
93
+ secrets: nil,
86
94
  network_block_all: nil,
87
95
  network_allow_list: nil,
88
96
  domain_allow_list: nil,
@@ -99,6 +107,7 @@ module Daytona
99
107
  @auto_archive_interval = auto_archive_interval
100
108
  @auto_delete_interval = auto_delete_interval
101
109
  @volumes = volumes
110
+ @secrets = secrets
102
111
  @network_block_all = network_block_all
103
112
  @network_allow_list = network_allow_list
104
113
  @domain_allow_list = domain_allow_list
@@ -124,6 +133,7 @@ module Daytona
124
133
  auto_archive_interval:,
125
134
  auto_delete_interval:,
126
135
  volumes:,
136
+ secrets:,
127
137
  network_block_all:,
128
138
  network_allow_list:,
129
139
  domain_allow_list:,
@@ -171,6 +181,8 @@ module Daytona
171
181
  # @param auto_archive_interval [Integer, nil] Auto-archive interval in minutes
172
182
  # @param auto_delete_interval [Integer, nil] Auto-delete interval in minutes
173
183
  # @param volumes [Array<DaytonaApiClient::SandboxVolume>, nil] List of volumes mounts to attach to the Sandbox
184
+ # @param secrets [Hash<String, String>, nil] Organization Secrets to expose in the Sandbox, as a
185
+ # mapping of env var name to existing Secret name
174
186
  # @param network_block_all [Boolean, nil] Whether to block all network access for the Sandbox
175
187
  # @param network_allow_list [String, nil] Comma-separated list of allowed CIDR network addresses for the Sandbox
176
188
  # @param domain_allow_list [String, nil] Comma-separated list of allowed domains for the Sandbox
@@ -210,6 +222,8 @@ module Daytona
210
222
  # @param auto_archive_interval [Integer, nil] Auto-archive interval in minutes
211
223
  # @param auto_delete_interval [Integer, nil] Auto-delete interval in minutes
212
224
  # @param volumes [Array<DaytonaApiClient::SandboxVolume>, nil] List of volumes mounts to attach to the Sandbox
225
+ # @param secrets [Hash<String, String>, nil] Organization Secrets to expose in the Sandbox, as a
226
+ # mapping of env var name to existing Secret name
213
227
  # @param network_block_all [Boolean, nil] Whether to block all network access for the Sandbox
214
228
  # @param network_allow_list [String, nil] Comma-separated list of allowed CIDR network addresses for the Sandbox
215
229
  # @param domain_allow_list [String, nil] Comma-separated list of allowed domains for the Sandbox
@@ -22,6 +22,9 @@ module Daytona
22
22
  # @return [Daytona::VolumeService]
23
23
  attr_reader :volume
24
24
 
25
+ # @return [Daytona::SecretService]
26
+ attr_reader :secret
27
+
25
28
  # @return [DaytonaApiClient::ObjectStorageApi]
26
29
  attr_reader :object_storage_api
27
30
 
@@ -46,6 +49,7 @@ module Daytona
46
49
  @sandbox_api = DaytonaApiClient::SandboxApi.new(api_client)
47
50
  @config_api = DaytonaApiClient::ConfigApi.new(api_client)
48
51
  @volume = VolumeService.new(DaytonaApiClient::VolumesApi.new(api_client), otel_state:)
52
+ @secret = SecretService.new(DaytonaApiClient::SecretApi.new(api_client), otel_state:)
49
53
  @object_storage_api = DaytonaApiClient::ObjectStorageApi.new(api_client)
50
54
  @snapshots_api = DaytonaApiClient::SnapshotsApi.new(api_client)
51
55
  @snapshot = SnapshotService.new(snapshots_api:, object_storage_api:, default_region_id: config.target,
@@ -213,6 +217,7 @@ module Daytona
213
217
  auto_archive_interval: params.auto_archive_interval,
214
218
  auto_delete_interval: params.auto_delete_interval,
215
219
  volumes: params.volumes,
220
+ secrets: params.secrets&.map { |env_var, secret_name| { env_var.to_s => secret_name.to_s } },
216
221
  network_block_all: params.network_block_all,
217
222
  network_allow_list: params.network_allow_list,
218
223
  domain_allow_list: params.domain_allow_list,
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Daytona
7
7
  module Sdk
8
- VERSION = '0.191.0'
8
+ VERSION = '0.192.0'
9
9
  end
10
10
  end
data/lib/daytona/sdk.rb CHANGED
@@ -33,6 +33,8 @@ require_relative 'git'
33
33
  require_relative 'lsp_server'
34
34
  require_relative 'object_storage'
35
35
  require_relative 'sandbox'
36
+ require_relative 'secret'
37
+ require_relative 'secret_service'
36
38
  require_relative 'snapshot_service'
37
39
  require_relative 'util'
38
40
  require_relative 'volume'
@@ -0,0 +1,46 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ # frozen_string_literal: true
5
+
6
+ module Daytona
7
+ class Secret
8
+ # @return [String]
9
+ attr_reader :id
10
+
11
+ # @return [String]
12
+ attr_reader :name
13
+
14
+ # @return [String, nil]
15
+ attr_reader :description
16
+
17
+ # @return [String] Opaque placeholder token injected as the env var value in Sandboxes. The
18
+ # placeholder is resolved to the real plaintext value only for the secret's allowed hosts.
19
+ attr_reader :placeholder
20
+
21
+ # @return [Array<String>] Allowed hosts this secret may be sent to. Accepts exact hostnames
22
+ # and +*.+ wildcards (no ports).
23
+ attr_reader :hosts
24
+
25
+ # @return [String]
26
+ attr_reader :created_at
27
+
28
+ # @return [String]
29
+ attr_reader :updated_at
30
+
31
+ # Initialize secret from DTO
32
+ #
33
+ # The plaintext value is write-only and is never returned by the API, so it is not exposed here.
34
+ #
35
+ # @param secret_dto [DaytonaApiClient::Secret]
36
+ def initialize(secret_dto)
37
+ @id = secret_dto.id
38
+ @name = secret_dto.name
39
+ @description = secret_dto.description
40
+ @placeholder = secret_dto.placeholder
41
+ @hosts = secret_dto.hosts
42
+ @created_at = secret_dto.created_at
43
+ @updated_at = secret_dto.updated_at
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,86 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ # frozen_string_literal: true
5
+
6
+ module Daytona
7
+ class SecretService
8
+ include Instrumentation
9
+
10
+ # Service for managing organization-scoped Daytona Secrets. Can be used to list, get, create,
11
+ # update and delete Secrets.
12
+ #
13
+ # A Secret stores a plaintext +value+ that is never returned by the API. When a Secret is
14
+ # referenced while creating a Sandbox, the corresponding env var holds an opaque +placeholder+
15
+ # that is resolved to the real value only for the Secret's allowed +hosts+.
16
+ #
17
+ # @param secret_api [DaytonaApiClient::SecretApi]
18
+ # @param otel_state [Daytona::OtelState, nil]
19
+ def initialize(secret_api, otel_state: nil)
20
+ @secret_api = secret_api
21
+ @otel_state = otel_state
22
+ end
23
+
24
+ # Create a new Secret.
25
+ #
26
+ # @param name [String] Name of the Secret. Must match +^[a-zA-Z_][a-zA-Z0-9_-]*$+ and be unique
27
+ # within the organization (a duplicate name raises a 409 error).
28
+ # @param value [String] Plaintext value of the Secret. Write-only; never returned by the API.
29
+ # @param description [String, nil] Optional description of the Secret.
30
+ # @param hosts [Array<String>, nil] Allowed hosts this Secret may be sent to. Accepts exact
31
+ # hostnames and +*.+ wildcards (no ports).
32
+ # @return [Daytona::Secret]
33
+ def create(name, value, description: nil, hosts: nil)
34
+ Secret.new(secret_api.create_secret(
35
+ DaytonaApiClient::CreateSecret.new(name:, value:, description:, hosts:)
36
+ ))
37
+ end
38
+
39
+ # Delete a Secret.
40
+ #
41
+ # @param secret_id [String]
42
+ # @return [void]
43
+ # @raise [DaytonaApiClient::ApiError] If no Secret with the given ID exists (404).
44
+ def delete(secret_id) = secret_api.delete_secret(secret_id)
45
+
46
+ # Get a Secret by ID.
47
+ #
48
+ # @param secret_id [String]
49
+ # @return [Daytona::Secret]
50
+ # @raise [DaytonaApiClient::ApiError] If no Secret with the given ID exists (404).
51
+ def get(secret_id) = Secret.new(secret_api.get_secret(secret_id))
52
+
53
+ # List all Secrets.
54
+ #
55
+ # @return [Array<Daytona::Secret>]
56
+ def list
57
+ secret_api.list_secrets.map { |secret| Secret.new(secret) }
58
+ end
59
+
60
+ # Update a Secret.
61
+ #
62
+ # @param secret_id [String]
63
+ # @param value [String, nil] New plaintext value. Write-only; never returned by the API.
64
+ # @param description [String, nil] New description of the Secret.
65
+ # @param hosts [Array<String>, nil] Allowed hosts this Secret may be sent to. Accepts exact
66
+ # hostnames and +*.+ wildcards (no ports).
67
+ # @return [Daytona::Secret]
68
+ # @raise [DaytonaApiClient::ApiError] If no Secret with the given ID exists (404).
69
+ def update(secret_id, value: nil, description: nil, hosts: nil)
70
+ Secret.new(secret_api.update_secret(
71
+ secret_id,
72
+ DaytonaApiClient::UpdateSecret.new(value:, description:, hosts:)
73
+ ))
74
+ end
75
+
76
+ instrument :create, :delete, :get, :list, :update, component: 'SecretService'
77
+
78
+ private
79
+
80
+ # @return [DaytonaApiClient::SecretApi]
81
+ attr_reader :secret_api
82
+
83
+ # @return [Daytona::OtelState, nil]
84
+ attr_reader :otel_state
85
+ end
86
+ end
@@ -21,11 +21,13 @@ CLASSES_TO_DOCUMENT = [
21
21
  ['process.rb', 'process.mdx', 'Daytona::Process'],
22
22
  ['lsp_server.rb', 'lsp-server.mdx', 'Daytona::LspServer'],
23
23
  ['volume.rb', 'volume.mdx', 'Daytona::Volume'],
24
+ ['secret.rb', 'secret.mdx', 'Daytona::Secret'],
24
25
  ['object_storage.rb', 'object-storage.mdx', 'Daytona::ObjectStorage'],
25
26
  ['computer_use.rb', 'computer-use.mdx', 'Daytona::ComputerUse'],
26
27
  ['computer_use.rb', 'computer-use.mdx', 'Daytona::ComputerUse::Accessibility'],
27
28
  ['snapshot_service.rb', 'snapshot.mdx', 'Daytona::SnapshotService'],
28
29
  ['volume_service.rb', 'volume-service.mdx', 'Daytona::VolumeService'],
30
+ ['secret_service.rb', 'secret-service.mdx', 'Daytona::SecretService'],
29
31
  ['common/charts.rb', 'charts.mdx', 'Daytona::Chart'],
30
32
  ['common/image.rb', 'image.mdx', 'Daytona::Image']
31
33
  ]
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.191.0
4
+ version: 0.192.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.191.0
88
+ version: 0.192.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.191.0
95
+ version: 0.192.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.191.0
102
+ version: 0.192.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.191.0
109
+ version: 0.192.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: dotenv
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +205,8 @@ files:
205
205
  - lib/daytona/sandbox.rb
206
206
  - lib/daytona/sdk.rb
207
207
  - lib/daytona/sdk/version.rb
208
+ - lib/daytona/secret.rb
209
+ - lib/daytona/secret_service.rb
208
210
  - lib/daytona/snapshot_service.rb
209
211
  - lib/daytona/util.rb
210
212
  - lib/daytona/volume.rb