daytona 0.223.1 → 0.224.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: 63db7dba8b656d1b2ba3c613a1ca9896211bf22b1c6430ed1d8e23e0e517a4c0
4
- data.tar.gz: f8af7a09143410175e8936a76a1b8471578fded4267c5307b86cf3c9ddb1b834
3
+ metadata.gz: 9073174dfdaf41ddfeeff8c273346f9802806c7e39025f7efdf07eb5aaf32395
4
+ data.tar.gz: 27dcffd7cbeba0eabb88148108c5467995f16abb709820511c43a17a5568d8d5
5
5
  SHA512:
6
- metadata.gz: 497a18b1e9bd0f6077bac4195f05af4cc814140a875c2ae4308957a5be8389cf474ba0b504da18e2fa4f8414333111b4f9f64151f5ed111334b9d82e0b531df9
7
- data.tar.gz: ed9e925a0c2516974204f11229e655eae7e7ca1365e018160e7d6d0a17e2790f491c044e3242f48bfeb4e25a4dfb01d8d8455a7848303b1fc41c33fc8ba53d9a
6
+ metadata.gz: 958b391e87200ff87e0f643f3ddd66901b82d47528aaa2ec6986ea3726ac64e26474b3456a07146adb496c857daf3ca978c5a0793d954891cf350314ed0761fa
7
+ data.tar.gz: 381ecfdc0266799593abc3dc3aebbce9c077e41102852456c089f32e81f7992e4bad86231300378d6da5953edf78432f83d214cb288ebff0343fab755e274c25
data/README.md CHANGED
@@ -30,7 +30,7 @@ Configure the SDK using [environment variables](https://www.daytona.io/docs/en/c
30
30
 
31
31
  - `DAYTONA_API_KEY`: Your Daytona [API key](https://www.daytona.io/docs/en/api-keys/)
32
32
  - `DAYTONA_API_URL`: The Daytona [API URL](https://www.daytona.io/docs/en/tools/api/)
33
- - `DAYTONA_TARGET`: Your target [region](https://www.daytona.io/docs/en/regions/) environment (e.g. `us`, `eu`)
33
+ - `DAYTONA_TARGET`: Default [region](https://www.daytona.io/docs/en/regions/) for sandboxes and snapshots (e.g. `us`, `eu`); a per-call `target:` / `region_id:` overrides it
34
34
 
35
35
  ```ruby
36
36
  require 'daytona'
@@ -62,6 +62,20 @@ sandbox = daytona.create
62
62
 
63
63
  Daytona provides [examples](https://www.daytona.io/docs/en/getting-started/#examples) and [guides](https://www.daytona.io/docs/en/guides/) for common sandbox operations, best practices, and a wide range of topics, from basic usage to advanced topics, showcasing various types of integrations between Daytona and other tools.
64
64
 
65
+ ### Create a sandbox or snapshot in a specific region
66
+
67
+ Pass `target:` in the sandbox create params, or `region_id:` in the snapshot create params, to choose the [region](https://www.daytona.io/docs/en/regions/) for that call. The region is resolved per call: the per-call value, then the client-level `target` (or `DAYTONA_TARGET`), then the organization's default region.
68
+
69
+ ```ruby
70
+ require 'daytona'
71
+
72
+ daytona = Daytona::Daytona.new
73
+ sandbox = daytona.create(Daytona::CreateSandboxFromSnapshotParams.new(target: 'eu'))
74
+ snapshot = daytona.snapshot.create(
75
+ Daytona::CreateSnapshotParams.new(name: 'my-snapshot', image: 'python:3.12', region_id: 'eu')
76
+ )
77
+ ```
78
+
65
79
  ### Create a sandbox with custom resources
66
80
 
67
81
  Create a sandbox with [custom resources](https://www.daytona.io/docs/en/sandboxes/#resources) (CPU, memory, disk).
@@ -86,6 +86,11 @@ module Daytona
86
86
  # ephemeral (auto_delete_interval=0) and cannot themselves be linked to another Sandbox.
87
87
  attr_accessor :linked_sandbox
88
88
 
89
+ # @return [String, nil] Target (region) where the Sandbox is created. Overrides the client-level
90
+ # target for this call. If omitted, uses the client-level target when set; otherwise the
91
+ # organization's default region.
92
+ attr_accessor :target
93
+
89
94
  # Initialize CreateSandboxBaseParams
90
95
  #
91
96
  # @param language [Symbol, nil] Programming language for the Sandbox
@@ -118,6 +123,8 @@ module Daytona
118
123
  # @param spot [Boolean, nil] GPU-only. Whether the Sandbox may be instantly terminated to free GPU
119
124
  # capacity for an on-demand GPU Sandbox
120
125
  # @param linked_sandbox [String, nil] ID or name of an existing Sandbox to link the new Sandbox to
126
+ # @param target [String, nil] Target (region) where the Sandbox is created. Overrides the client-level
127
+ # target for this call.
121
128
  def initialize( # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists
122
129
  language: nil,
123
130
  os_user: nil,
@@ -141,7 +148,8 @@ module Daytona
141
148
  otel_endpoint_override: nil,
142
149
  ephemeral: nil,
143
150
  spot: nil,
144
- linked_sandbox: nil
151
+ linked_sandbox: nil,
152
+ target: nil
145
153
  )
146
154
  @language = language
147
155
  @os_user = os_user
@@ -166,6 +174,7 @@ module Daytona
166
174
  @ephemeral = ephemeral
167
175
  @spot = spot
168
176
  @linked_sandbox = linked_sandbox
177
+ @target = target
169
178
 
170
179
  # Handle ephemeral and auto_delete_interval conflict
171
180
  handle_ephemeral_auto_delete_conflict
@@ -198,7 +207,8 @@ module Daytona
198
207
  otel_endpoint_override:,
199
208
  ephemeral:,
200
209
  spot:,
201
- linked_sandbox:
210
+ linked_sandbox:,
211
+ target:
202
212
  }.compact
203
213
  end
204
214
 
@@ -30,7 +30,8 @@ module Daytona
30
30
  # @param image [String, Daytona::Image] Image of the snapshot
31
31
  # @param resources [Daytona::Resources, nil] Resources of the snapshot
32
32
  # @param entrypoint [Array<String>, nil] Entrypoint of the snapshot
33
- # @param region_id [String, nil] ID of the region where the snapshot will be available
33
+ # @param region_id [String, nil] ID of the region where the snapshot will be available. If omitted, uses
34
+ # the client-level target when set; otherwise the organization's default region.
34
35
  # @param sandbox_class [DaytonaApiClient::SandboxClass, nil] Target sandbox class
35
36
  def initialize(name:, image:, resources: nil, entrypoint: nil, region_id: nil, sandbox_class: nil)
36
37
  @name = name
@@ -77,7 +77,8 @@ module Daytona
77
77
  # @return [String, nil] Daytona API URL
78
78
  attr_accessor :organization_id
79
79
 
80
- # Target environment for sandboxes
80
+ # Default region for Sandboxes and Snapshots. A per-call `target:` (Sandbox create params) or
81
+ # `region_id:` (Snapshot create params) overrides it.
81
82
  #
82
83
  # @return [String, nil] Daytona target
83
84
  attr_accessor :target
@@ -108,7 +109,8 @@ module Daytona
108
109
  # @param jwt_token [String, nil] Daytona JWT token. Defaults to ENV['DAYTONA_JWT_TOKEN'].
109
110
  # @param api_url [String, nil] Daytona API URL. Defaults to ENV['DAYTONA_API_URL'] or Daytona::Config::API_URL.
110
111
  # @param organization_id [String, nil] Daytona organization ID. Defaults to ENV['DAYTONA_ORGANIZATION_ID'].
111
- # @param target [String, nil] Daytona target. Defaults to ENV['DAYTONA_TARGET'].
112
+ # @param target [String, nil] Default region for Sandboxes and Snapshots; a per-call `target:` / `region_id:`
113
+ # overrides it. Defaults to ENV['DAYTONA_TARGET'].
112
114
  # @param otel_enabled [Boolean, nil] Enable OpenTelemetry tracing for SDK operations.
113
115
  # @param use_deprecated_polling [Boolean, nil] Observe sandbox state by legacy polling instead of
114
116
  # WebSocket event streaming. Defaults to false (event streaming). Can also be enabled via the
@@ -286,7 +286,7 @@ module Daytona
286
286
  env: params.env_vars || {},
287
287
  labels: labels,
288
288
  public: params.public,
289
- target: config.target,
289
+ target: params.target.to_s.empty? ? config.target : params.target,
290
290
  auto_stop_interval: params.auto_stop_interval,
291
291
  auto_pause_interval: params.auto_pause_interval,
292
292
  auto_archive_interval: params.auto_archive_interval,
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Daytona
7
7
  module Sdk
8
- VERSION = '0.223.1'
8
+ VERSION = '0.224.0'
9
9
  end
10
10
  end
@@ -117,7 +117,7 @@ module Daytona
117
117
  create_snapshot_req.disk = params.resources.disk
118
118
  end
119
119
 
120
- create_snapshot_req.region_id = params.region_id || @default_region_id
120
+ create_snapshot_req.region_id = params.region_id.to_s.empty? ? @default_region_id : params.region_id
121
121
  create_snapshot_req.sandbox_class = params.sandbox_class
122
122
 
123
123
  snapshot = snapshots_api.create_snapshot(create_snapshot_req)
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.223.1
4
+ version: 0.224.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
@@ -91,42 +91,42 @@ dependencies:
91
91
  requirements:
92
92
  - - '='
93
93
  - !ruby/object:Gem::Version
94
- version: 0.223.1
94
+ version: 0.224.0
95
95
  type: :runtime
96
96
  prerelease: false
97
97
  version_requirements: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 0.223.1
101
+ version: 0.224.0
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: daytona_api_client
104
104
  requirement: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 0.223.1
108
+ version: 0.224.0
109
109
  type: :runtime
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: 0.223.1
115
+ version: 0.224.0
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: daytona_toolbox_api_client
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - '='
121
121
  - !ruby/object:Gem::Version
122
- version: 0.223.1
122
+ version: 0.224.0
123
123
  type: :runtime
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - '='
128
128
  - !ruby/object:Gem::Version
129
- version: 0.223.1
129
+ version: 0.224.0
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: dotenv
132
132
  requirement: !ruby/object:Gem::Requirement