Class: Cerca::Resources::Agents
- Inherits:
-
Object
- Object
- Cerca::Resources::Agents
- Defined in:
- lib/cerca/resources/agents.rb
Instance Method Summary collapse
-
#create(configuration: nil, fleet_id: nil, metadata: nil, user_id: nil, request_options: {}) ⇒ Cerca::Models::Agent
Some parameter documentations has been truncated, see Models::AgentCreateParams for more details.
-
#delete(agent_id, request_options: {}) ⇒ Cerca::Models::AgentDeleteResponse
Delete agent.
-
#initialize(client:) ⇒ Agents
constructor
private
A new instance of Agents.
-
#list(active: nil, cursor: nil, fleet_id: nil, limit: nil, request_options: {}) ⇒ Cerca::Internal::AgentsCursorPage<Cerca::Models::AgentSummary>
Some parameter documentations has been truncated, see Models::AgentListParams for more details.
-
#list_tools(agent_id, request_options: {}) ⇒ Cerca::Models::AgentListToolsResponse
List tools.
-
#retrieve(agent_id, request_options: {}) ⇒ Cerca::Models::Agent
Retrieve agent.
-
#retrieve_config(agent_id, request_options: {}) ⇒ Cerca::Models::EffectiveConfiguration
Retrieve config.
-
#update(agent_id, configuration:, request_options: {}) ⇒ Cerca::Models::Agent
Update agent.
-
#update_metadata(agent_id, metadata:, request_options: {}) ⇒ Cerca::Models::Agent
Some parameter documentations has been truncated, see Models::AgentUpdateMetadataParams for more details.
Constructor Details
#initialize(client:) ⇒ Agents
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 Agents.
192 193 194 |
# File 'lib/cerca/resources/agents.rb', line 192 def initialize(client:) @client = client end |
Instance Method Details
#create(configuration: nil, fleet_id: nil, metadata: nil, user_id: nil, request_options: {}) ⇒ Cerca::Models::Agent
Some parameter documentations has been truncated, see Models::AgentCreateParams for more details.
Create agent
26 27 28 29 |
# File 'lib/cerca/resources/agents.rb', line 26 def create(params = {}) parsed, = Cerca::AgentCreateParams.dump_request(params) @client.request(method: :post, path: "agents", body: parsed, model: Cerca::Agent, options: ) end |
#delete(agent_id, request_options: {}) ⇒ Cerca::Models::AgentDeleteResponse
Delete agent
115 116 117 118 119 120 121 122 |
# File 'lib/cerca/resources/agents.rb', line 115 def delete(agent_id, params = {}) @client.request( method: :delete, path: ["agents/%1$s", agent_id], model: Cerca::Models::AgentDeleteResponse, options: params[:request_options] ) end |
#list(active: nil, cursor: nil, fleet_id: nil, limit: nil, request_options: {}) ⇒ Cerca::Internal::AgentsCursorPage<Cerca::Models::AgentSummary>
Some parameter documentations has been truncated, see Models::AgentListParams for more details.
List agents
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/cerca/resources/agents.rb', line 92 def list(params = {}) parsed, = Cerca::AgentListParams.dump_request(params) query = Cerca::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "agents", query: query.transform_keys(fleet_id: "fleetId"), page: Cerca::Internal::AgentsCursorPage, model: Cerca::AgentSummary, options: ) end |
#list_tools(agent_id, request_options: {}) ⇒ Cerca::Models::AgentListToolsResponse
List tools
134 135 136 137 138 139 140 141 |
# File 'lib/cerca/resources/agents.rb', line 134 def list_tools(agent_id, params = {}) @client.request( method: :get, path: ["agents/%1$s/tools", agent_id], model: Cerca::Models::AgentListToolsResponse, options: params[:request_options] ) end |
#retrieve(agent_id, request_options: {}) ⇒ Cerca::Models::Agent
Retrieve agent
41 42 43 44 45 46 47 48 |
# File 'lib/cerca/resources/agents.rb', line 41 def retrieve(agent_id, params = {}) @client.request( method: :get, path: ["agents/%1$s", agent_id], model: Cerca::Agent, options: params[:request_options] ) end |
#retrieve_config(agent_id, request_options: {}) ⇒ Cerca::Models::EffectiveConfiguration
Retrieve config
153 154 155 156 157 158 159 160 |
# File 'lib/cerca/resources/agents.rb', line 153 def retrieve_config(agent_id, params = {}) @client.request( method: :get, path: ["agents/%1$s/config", agent_id], model: Cerca::EffectiveConfiguration, options: params[:request_options] ) end |
#update(agent_id, configuration:, request_options: {}) ⇒ Cerca::Models::Agent
Update agent
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/cerca/resources/agents.rb', line 61 def update(agent_id, params) parsed, = Cerca::AgentUpdateParams.dump_request(params) @client.request( method: :put, path: ["agents/%1$s", agent_id], body: parsed, model: Cerca::Agent, options: ) end |
#update_metadata(agent_id, metadata:, request_options: {}) ⇒ Cerca::Models::Agent
Some parameter documentations has been truncated, see Models::AgentUpdateMetadataParams for more details.
Update metadata
178 179 180 181 182 183 184 185 186 187 |
# File 'lib/cerca/resources/agents.rb', line 178 def (agent_id, params) parsed, = Cerca::AgentUpdateMetadataParams.dump_request(params) @client.request( method: :patch, path: ["agents/%1$s/metadata", agent_id], body: parsed, model: Cerca::Agent, options: ) end |