Class: Repull::KVApi
- Inherits:
-
Object
- Object
- Repull::KVApi
- Defined in:
- lib/repull/api/kv_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#clear_kv(prefix, opts = {}) ⇒ ClearKv200Response
Clear KV entries by prefix Bulk-deletes every key in the project whose name starts with ‘prefix`.
-
#clear_kv_with_http_info(prefix, opts = {}) ⇒ Array<(ClearKv200Response, Integer, Hash)>
Clear KV entries by prefix Bulk-deletes every key in the project whose name starts with `prefix`.
-
#delete_kv(key, opts = {}) ⇒ DeleteKv200Response
Delete a KV entry Removes a single key.
-
#delete_kv_with_http_info(key, opts = {}) ⇒ Array<(DeleteKv200Response, Integer, Hash)>
Delete a KV entry Removes a single key.
-
#get_kv(key, opts = {}) ⇒ ListKv200ResponseDataInner
Get a KV entry Fetches a single key.
-
#get_kv_with_http_info(key, opts = {}) ⇒ Array<(ListKv200ResponseDataInner, Integer, Hash)>
Get a KV entry Fetches a single key.
-
#initialize(api_client = ApiClient.default) ⇒ KVApi
constructor
A new instance of KVApi.
-
#list_kv(opts = {}) ⇒ ListKv200Response
List KV entries Returns every non-expired key-value row in the given project, sorted ascending by key.
-
#list_kv_with_http_info(opts = {}) ⇒ Array<(ListKv200Response, Integer, Hash)>
List KV entries Returns every non-expired key-value row in the given project, sorted ascending by key.
-
#set_kv(key, set_kv_request, opts = {}) ⇒ ListKv200ResponseDataInner
Set a KV entry Upserts a key.
-
#set_kv_with_http_info(key, set_kv_request, opts = {}) ⇒ Array<(ListKv200ResponseDataInner, Integer, Hash)>
Set a KV entry Upserts a key.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/repull/api/kv_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#clear_kv(prefix, opts = {}) ⇒ ClearKv200Response
Clear KV entries by prefix Bulk-deletes every key in the project whose name starts with ‘prefix`. The `prefix` parameter is required — there is no "delete every key in this project" shortcut; pass an empty `prefix` is rejected with 422 to prevent accidental wipes. Returns the number of rows removed.
28 29 30 31 |
# File 'lib/repull/api/kv_api.rb', line 28 def clear_kv(prefix, opts = {}) data, _status_code, _headers = clear_kv_with_http_info(prefix, opts) data end |
#clear_kv_with_http_info(prefix, opts = {}) ⇒ Array<(ClearKv200Response, Integer, Hash)>
Clear KV entries by prefix Bulk-deletes every key in the project whose name starts with `prefix`. The `prefix` parameter is required — there is no "delete every key in this project" shortcut; pass an empty `prefix` is rejected with 422 to prevent accidental wipes. Returns the number of rows removed.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/repull/api/kv_api.rb', line 39 def clear_kv_with_http_info(prefix, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KVApi.clear_kv ...' end # verify the required parameter 'prefix' is set if @api_client.config.client_side_validation && prefix.nil? fail ArgumentError, "Missing the required parameter 'prefix' when calling KVApi.clear_kv" end # resource path local_var_path = '/v1/kv' # query parameters query_params = opts[:query_params] || {} query_params[:'prefix'] = prefix query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ClearKv200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"KVApi.clear_kv", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: KVApi#clear_kv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_kv(key, opts = {}) ⇒ DeleteKv200Response
Delete a KV entry Removes a single key. Returns ‘{ deleted: true }` if the row was present, `{ deleted: false }` if it was already absent — both are 200 (idempotent).
95 96 97 98 |
# File 'lib/repull/api/kv_api.rb', line 95 def delete_kv(key, opts = {}) data, _status_code, _headers = delete_kv_with_http_info(key, opts) data end |
#delete_kv_with_http_info(key, opts = {}) ⇒ Array<(DeleteKv200Response, Integer, Hash)>
Delete a KV entry Removes a single key. Returns `{ deleted: true }` if the row was present, `{ deleted: false }` if it was already absent — both are 200 (idempotent).
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/repull/api/kv_api.rb', line 106 def delete_kv_with_http_info(key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KVApi.delete_kv ...' end # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? fail ArgumentError, "Missing the required parameter 'key' when calling KVApi.delete_kv" end # resource path local_var_path = '/v1/kv/{key}'.sub('{key}', CGI.escape(key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DeleteKv200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"KVApi.delete_kv", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: KVApi#delete_kv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_kv(key, opts = {}) ⇒ ListKv200ResponseDataInner
Get a KV entry Fetches a single key. Returns 404 when the key does not exist OR has expired (rows past ‘ttl_at` are filtered from reads). Cross-tenant lookups also return 404 — the API never reveals existence of another customer’s keys.
161 162 163 164 |
# File 'lib/repull/api/kv_api.rb', line 161 def get_kv(key, opts = {}) data, _status_code, _headers = get_kv_with_http_info(key, opts) data end |
#get_kv_with_http_info(key, opts = {}) ⇒ Array<(ListKv200ResponseDataInner, Integer, Hash)>
Get a KV entry Fetches a single key. Returns 404 when the key does not exist OR has expired (rows past `ttl_at` are filtered from reads). Cross-tenant lookups also return 404 — the API never reveals existence of another customer's keys.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/repull/api/kv_api.rb', line 172 def get_kv_with_http_info(key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KVApi.get_kv ...' end # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? fail ArgumentError, "Missing the required parameter 'key' when calling KVApi.get_kv" end # resource path local_var_path = '/v1/kv/{key}'.sub('{key}', CGI.escape(key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListKv200ResponseDataInner' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"KVApi.get_kv", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: KVApi#get_kv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_kv(opts = {}) ⇒ ListKv200Response
List KV entries Returns every non-expired key-value row in the given project, sorted ascending by key. Use ‘prefix` to scope to a key namespace (e.g. `prefix=user:42:` to fetch all entries for one user). Hard cap of 1,000 rows per response — for projects approaching that, paginate by walking prefix buckets.
227 228 229 230 |
# File 'lib/repull/api/kv_api.rb', line 227 def list_kv(opts = {}) data, _status_code, _headers = list_kv_with_http_info(opts) data end |
#list_kv_with_http_info(opts = {}) ⇒ Array<(ListKv200Response, Integer, Hash)>
List KV entries Returns every non-expired key-value row in the given project, sorted ascending by key. Use `prefix` to scope to a key namespace (e.g. `prefix=user:42:` to fetch all entries for one user). Hard cap of 1,000 rows per response — for projects approaching that, paginate by walking prefix buckets.
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/repull/api/kv_api.rb', line 238 def list_kv_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KVApi.list_kv ...' end # resource path local_var_path = '/v1/kv' # query parameters query_params = opts[:query_params] || {} query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListKv200Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"KVApi.list_kv", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: KVApi#list_kv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#set_kv(key, set_kv_request, opts = {}) ⇒ ListKv200ResponseDataInner
Set a KV entry Upserts a key. The full row is replaced — there is no partial update. Pass ‘ttl_seconds` (positive integer) to auto-expire the row; omit for no expiry. Caps: 64 KiB per row (key bytes + value JSON bytes), 1 MiB per customer (sum across ALL projects/keys). Over either cap returns 413.
291 292 293 294 |
# File 'lib/repull/api/kv_api.rb', line 291 def set_kv(key, set_kv_request, opts = {}) data, _status_code, _headers = set_kv_with_http_info(key, set_kv_request, opts) data end |
#set_kv_with_http_info(key, set_kv_request, opts = {}) ⇒ Array<(ListKv200ResponseDataInner, Integer, Hash)>
Set a KV entry Upserts a key. The full row is replaced — there is no partial update. Pass `ttl_seconds` (positive integer) to auto-expire the row; omit for no expiry. Caps: 64 KiB per row (key bytes + value JSON bytes), 1 MiB per customer (sum across ALL projects/keys). Over either cap returns 413.
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/repull/api/kv_api.rb', line 303 def set_kv_with_http_info(key, set_kv_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KVApi.set_kv ...' end # verify the required parameter 'key' is set if @api_client.config.client_side_validation && key.nil? fail ArgumentError, "Missing the required parameter 'key' when calling KVApi.set_kv" end # verify the required parameter 'set_kv_request' is set if @api_client.config.client_side_validation && set_kv_request.nil? fail ArgumentError, "Missing the required parameter 'set_kv_request' when calling KVApi.set_kv" end # resource path local_var_path = '/v1/kv/{key}'.sub('{key}', CGI.escape(key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'project_id'] = opts[:'project_id'] if !opts[:'project_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(set_kv_request) # return_type return_type = opts[:debug_return_type] || 'ListKv200ResponseDataInner' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"KVApi.set_kv", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: KVApi#set_kv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |