Class: Daytona::CreateSandboxFromImageParams

Inherits:
CreateSandboxBaseParams show all
Defined in:
lib/daytona/common/daytona.rb

Instance Attribute Summary collapse

Attributes inherited from CreateSandboxBaseParams

#auto_archive_interval, #auto_delete_interval, #auto_pause_interval, #auto_stop_interval, #domain_allow_list, #env_vars, #ephemeral, #labels, #language, #linked_sandbox, #network_allow_list, #network_block_all, #os_user, #otel_endpoint_override, #outbound_proxy_url, #public, #secrets, #spot, #timeout, #ttl_minutes, #volumes

Instance Method Summary collapse

Constructor Details

#initialize(image:, resources: nil, **args) ⇒ CreateSandboxFromImageParams

Initialize CreateSandboxFromImageParams

Parameters:

  • image (String, Image)

    Custom Docker image to use for the Sandbox

  • resources (Daytona::Resources, nil) (defaults to: nil)

    Resource configuration for the Sandbox

  • language (Symbol, nil)

    Programming language for the Sandbox

  • os_user (String, nil)

    OS user for the Sandbox

  • env_vars (Hash<String, String>, nil)

    Environment variables to set in the Sandbox

  • labels (Hash<String, String>, nil)

    Custom labels for the Sandbox

  • public (Boolean, nil)

    Whether the Sandbox should be public

  • timeout (Float, nil)

    Timeout in seconds for Sandbox to be created and started

  • auto_stop_interval (Integer, nil)

    Auto-stop interval in minutes

  • auto_pause_interval (Integer, nil)

    Auto-pause interval in minutes

  • auto_archive_interval (Integer, nil)

    Auto-archive interval in minutes

  • auto_delete_interval (Integer, nil)

    Auto-delete interval in minutes

  • ttl_minutes (Integer, nil)

    Time to live in minutes (0 to disable)

  • volumes (Array<DaytonaApiClient::SandboxVolume>, nil)

    List of volumes mounts to attach to the Sandbox

  • secrets (Hash<String, String>, nil)

    Organization Secrets to expose in the Sandbox, as a mapping of env var name to existing Secret name

  • network_block_all (Boolean, nil)

    Whether to block all network access for the Sandbox

  • network_allow_list (String, nil)

    Comma-separated list of allowed CIDR network addresses for the Sandbox

  • domain_allow_list (String, nil)

    Comma-separated list of allowed domains for the Sandbox

  • outbound_proxy_url (String, nil)

    Outbound proxy URL to route the Sandbox HTTP(S) traffic through. Applied via the HTTP(S)_PROXY environment variables; combine with domain_allow_list for network-layer enforcement.

  • otel_endpoint_override (String, nil)

    OTel collector endpoint override for the Sandbox. When set, sandbox OTel data is sent to this endpoint instead of the default collector and will not be available in the Daytona analytics API or dashboard.

  • ephemeral (Boolean, nil)

    Whether the Sandbox should be ephemeral



245
246
247
248
249
250
# File 'lib/daytona/common/daytona.rb', line 245

def initialize(image:, resources: nil, **args)
  @image = image
  @resources = resources

  super(**args)
end

Instance Attribute Details

#imageString, Image

Returns Custom Docker image to use for the Sandbox. If an Image object is provided, the image will be dynamically built.

Returns:

  • (String, Image)

    Custom Docker image to use for the Sandbox. If an Image object is provided, the image will be dynamically built.



211
212
213
# File 'lib/daytona/common/daytona.rb', line 211

def image
  @image
end

#resourcesDaytona::Resources?

Returns Resource configuration for the Sandbox. If not provided, sandbox will have default resources.

Returns:

  • (Daytona::Resources, nil)

    Resource configuration for the Sandbox. If not provided, sandbox will have default resources.



215
216
217
# File 'lib/daytona/common/daytona.rb', line 215

def resources
  @resources
end

Instance Method Details

#to_hHash<Symbol, Object>

Convert to hash representation

Returns:

  • (Hash<Symbol, Object>)

    Hash representation of the parameters



255
256
257
258
259
260
# File 'lib/daytona/common/daytona.rb', line 255

def to_h
  super.merge(
    image:,
    resources: resources&.to_h
  ).compact
end