Class: Cerca::Resources::Connections
- Inherits:
-
Object
- Object
- Cerca::Resources::Connections
- Defined in:
- lib/cerca/resources/connections.rb
Instance Method Summary collapse
-
#attach(agent_id, connection_id:, metadata: nil, request_options: {}) ⇒ Cerca::Models::AttachedConnection
Attach connection.
-
#create(api_key:, owner:, provider:, account_label: nil, request_options: {}) ⇒ Cerca::Models::Connection
Some parameter documentations has been truncated, see Models::ConnectionCreateParams for more details.
-
#delete(connection_id, owner_type:, fleet_id: nil, request_options: {}) ⇒ Cerca::Models::ConnectionDeleteResponse
Delete connection.
-
#detach(agent_id, connection_id, request_options: {}) ⇒ Cerca::Models::ConnectionDetachResponse
Detach connection.
-
#initialize(client:) ⇒ Connections
constructor
private
A new instance of Connections.
-
#list(owner_type:, cursor: nil, fleet_id: nil, limit: nil, request_options: {}) ⇒ Cerca::Internal::ConnectionsCursorPage<Cerca::Models::Connection>
Some parameter documentations has been truncated, see Models::ConnectionListParams for more details.
-
#list_for_agent(agent_id, request_options: {}) ⇒ Cerca::Models::ConnectionListForAgentResponse
List connections.
Constructor Details
#initialize(client:) ⇒ Connections
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 Connections.
162 163 164 |
# File 'lib/cerca/resources/connections.rb', line 162 def initialize(client:) @client = client end |
Instance Method Details
#attach(agent_id, connection_id:, metadata: nil, request_options: {}) ⇒ Cerca::Models::AttachedConnection
Attach connection
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/cerca/resources/connections.rb', line 109 def attach(agent_id, params) parsed, = Cerca::ConnectionAttachParams.dump_request(params) @client.request( method: :post, path: ["agents/%1$s/connections", agent_id], body: parsed, model: Cerca::AttachedConnection, options: ) end |
#create(api_key:, owner:, provider:, account_label: nil, request_options: {}) ⇒ Cerca::Models::Connection
Some parameter documentations has been truncated, see Models::ConnectionCreateParams for more details.
Create API key
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cerca/resources/connections.rb', line 26 def create(params) parsed, = Cerca::ConnectionCreateParams.dump_request(params) @client.request( method: :post, path: "connections/api-keys", body: parsed, model: Cerca::Connection, options: ) end |
#delete(connection_id, owner_type:, fleet_id: nil, request_options: {}) ⇒ Cerca::Models::ConnectionDeleteResponse
Delete connection
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/cerca/resources/connections.rb', line 85 def delete(connection_id, params) parsed, = Cerca::ConnectionDeleteParams.dump_request(params) query = Cerca::Internal::Util.encode_query_params(parsed) @client.request( method: :delete, path: ["connections/%1$s", connection_id], query: query.transform_keys(owner_type: "ownerType", fleet_id: "fleetId"), model: Cerca::Models::ConnectionDeleteResponse, options: ) end |
#detach(agent_id, connection_id, request_options: {}) ⇒ Cerca::Models::ConnectionDetachResponse
Detach connection
131 132 133 134 135 136 137 138 |
# File 'lib/cerca/resources/connections.rb', line 131 def detach(agent_id, connection_id, params = {}) @client.request( method: :delete, path: ["agents/%1$s/connections/%2$s", agent_id, connection_id], model: Cerca::Models::ConnectionDetachResponse, options: params[:request_options] ) end |
#list(owner_type:, cursor: nil, fleet_id: nil, limit: nil, request_options: {}) ⇒ Cerca::Internal::ConnectionsCursorPage<Cerca::Models::Connection>
Some parameter documentations has been truncated, see Models::ConnectionListParams for more details.
List connections
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/cerca/resources/connections.rb', line 57 def list(params) parsed, = Cerca::ConnectionListParams.dump_request(params) query = Cerca::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "connections", query: query.transform_keys(owner_type: "ownerType", fleet_id: "fleetId"), page: Cerca::Internal::ConnectionsCursorPage, model: Cerca::Connection, options: ) end |
#list_for_agent(agent_id, request_options: {}) ⇒ Cerca::Models::ConnectionListForAgentResponse
List connections
150 151 152 153 154 155 156 157 |
# File 'lib/cerca/resources/connections.rb', line 150 def list_for_agent(agent_id, params = {}) @client.request( method: :get, path: ["agents/%1$s/connections", agent_id], model: Cerca::Models::ConnectionListForAgentResponse, options: params[:request_options] ) end |