Class: Cerca::Resources::Sandbox

Inherits:
Object
  • Object
show all
Defined in:
lib/cerca/resources/sandbox.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Sandbox

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Sandbox.

Parameters:



86
87
88
# File 'lib/cerca/resources/sandbox.rb', line 86

def initialize(client:)
  @client = client
end

Instance Method Details

#exec_(agent_id, command:, max_buffer: nil, execution_timeout: nil, workdir: nil, request_options: {}) ⇒ Cerca::Models::ExecResult

Execute sandbox command

Parameters:

  • agent_id (String)
  • command (String)
  • max_buffer (Float)
  • execution_timeout (Float)

    Timeout in seconds. Runtime converts this to milliseconds.

  • workdir (String, nil)

    Optional sandbox working directory.

  • request_options (Cerca::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/cerca/resources/sandbox.rb', line 25

def exec_(agent_id, params)
  parsed, options = Cerca::SandboxExecParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["agents/%1$s/sandbox/exec", agent_id],
    body: parsed,
    model: Cerca::ExecResult,
    options: options
  )
end

#read(agent_id, path:, limit: nil, offset: nil, request_options: {}) ⇒ Cerca::Models::ReadResponse

Read sandbox file

Parameters:

  • agent_id (String)
  • path (String)
  • limit (Float)
  • offset (Float)
  • request_options (Cerca::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
# File 'lib/cerca/resources/sandbox.rb', line 49

def read(agent_id, params)
  parsed, options = Cerca::SandboxReadParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["agents/%1$s/sandbox/read", agent_id],
    body: parsed,
    model: Cerca::ReadResponse,
    options: options
  )
end

#write(agent_id, content:, path:, request_options: {}) ⇒ Cerca::Models::SandboxWriteResponse

Write sandbox file

Parameters:

  • agent_id (String)
  • content (String)
  • path (String)
  • request_options (Cerca::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



72
73
74
75
76
77
78
79
80
81
# File 'lib/cerca/resources/sandbox.rb', line 72

def write(agent_id, params)
  parsed, options = Cerca::SandboxWriteParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["agents/%1$s/sandbox/write", agent_id],
    body: parsed,
    model: Cerca::Models::SandboxWriteResponse,
    options: options
  )
end