Class: Cerca::Resources::Schedules

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Schedules

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 Schedules.

Parameters:



154
155
156
# File 'lib/cerca/resources/schedules.rb', line 154

def initialize(client:)
  @client = client
end

Instance Method Details

#create(agent_id, message:, name:, cron: nil, instructions: nil, model: nil, run_at: nil, timezone: nil, tools: nil, request_options: {}) ⇒ Cerca::Models::Schedule

Some parameter documentations has been truncated, see Models::ScheduleCreateParams for more details.

Create schedule

Parameters:

  • agent_id (String)
  • message (String)
  • name (String)
  • cron (String)
  • instructions (String)
  • model (String)
  • run_at (Time)
  • timezone (String)
  • tools (Array<String>)

    Per-schedule tool subset. When the schedule starts a thread, these tools can onl

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

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
# File 'lib/cerca/resources/schedules.rb', line 36

def create(agent_id, params)
  parsed, options = Cerca::ScheduleCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["agents/%1$s/schedules", agent_id],
    body: parsed,
    model: Cerca::Schedule,
    options: options
  )
end

#delete(agent_id, schedule_id, request_options: {}) ⇒ Cerca::Models::ScheduleDeleteResponse

Delete schedule

Parameters:

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

Returns:

See Also:



122
123
124
125
126
127
128
129
# File 'lib/cerca/resources/schedules.rb', line 122

def delete(agent_id, schedule_id, params = {})
  @client.request(
    method: :delete,
    path: ["agents/%1$s/schedules/%2$s", agent_id, schedule_id],
    model: Cerca::Models::ScheduleDeleteResponse,
    options: params[:request_options]
  )
end

#list(agent_id, request_options: {}) ⇒ Cerca::Models::ScheduleListResponse

List schedules

Parameters:

Returns:

See Also:



102
103
104
105
106
107
108
109
# File 'lib/cerca/resources/schedules.rb', line 102

def list(agent_id, params = {})
  @client.request(
    method: :get,
    path: ["agents/%1$s/schedules", agent_id],
    model: Cerca::Models::ScheduleListResponse,
    options: params[:request_options]
  )
end

#trigger(agent_id, schedule_id, request_options: {}) ⇒ Cerca::Models::ScheduleTriggerResponse

Trigger schedule

Parameters:

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

Returns:

See Also:



142
143
144
145
146
147
148
149
# File 'lib/cerca/resources/schedules.rb', line 142

def trigger(agent_id, schedule_id, params = {})
  @client.request(
    method: :post,
    path: ["agents/%1$s/schedules/%2$s/trigger", agent_id, schedule_id],
    model: Cerca::Models::ScheduleTriggerResponse,
    options: params[:request_options]
  )
end

#update(agent_id, schedule_id, cron: nil, enabled: nil, instructions: nil, message: nil, model: nil, name: nil, run_at: nil, timezone: nil, tools: nil, request_options: {}) ⇒ Cerca::Models::Schedule

Some parameter documentations has been truncated, see Models::ScheduleUpdateParams for more details.

Update schedule

Parameters:

  • agent_id (String)
  • schedule_id (String)
  • cron (String)
  • enabled (Boolean)
  • instructions (String)
  • message (String)
  • model (String)
  • name (String)
  • run_at (Time)
  • timezone (String)
  • tools (Array<String>)

    Per-schedule tool subset. When updated, these tools can only narrow the agent’s

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

Returns:

See Also:



81
82
83
84
85
86
87
88
89
90
# File 'lib/cerca/resources/schedules.rb', line 81

def update(agent_id, schedule_id, params = {})
  parsed, options = Cerca::ScheduleUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["agents/%1$s/schedules/%2$s", agent_id, schedule_id],
    body: parsed,
    model: Cerca::Schedule,
    options: options
  )
end