Class: Fastly::KvStoreItemApi
- Inherits:
-
Object
- Object
- Fastly::KvStoreItemApi
- Defined in:
- lib/fastly/api/kv_store_item_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ KvStoreItemApi
constructor
A new instance of KvStoreItemApi.
-
#kv_store_delete_item(opts = {}) ⇒ nil
Delete an item.
-
#kv_store_delete_item_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete an item.
-
#kv_store_get_item(opts = {}) ⇒ String
Get an item.
-
#kv_store_get_item_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Get an item.
-
#kv_store_list_item_keys(opts = {}) ⇒ InlineResponse2006
List item keys.
-
#kv_store_list_item_keys_with_http_info(opts = {}) ⇒ Array<(InlineResponse2006, Integer, Hash)>
List item keys.
-
#kv_store_upsert_item(opts = {}) ⇒ nil
Insert or update an item.
-
#kv_store_upsert_item_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>
Insert or update an item.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ KvStoreItemApi
Returns a new instance of KvStoreItemApi.
17 18 19 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 17 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
15 16 17 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 15 def api_client @api_client end |
Instance Method Details
#kv_store_delete_item(opts = {}) ⇒ nil
Delete an item. Delete an item.
27 28 29 30 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 27 def kv_store_delete_item(opts = {}) kv_store_delete_item_with_http_info(opts) nil end |
#kv_store_delete_item_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete an item. Delete an item.
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 88 89 90 91 92 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 39 def kv_store_delete_item_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KvStoreItemApi.kv_store_delete_item ...' end # unbox the parameters from the hash store_id = opts[:'store_id'] key = opts[:'key'] # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling KvStoreItemApi.kv_store_delete_item" 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 KvStoreItemApi.kv_store_delete_item" end # resource path local_var_path = '/resources/stores/kv/{store_id}/keys/{key}'.sub('{' + 'store_id' + '}', CGI.escape(store_id.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil? # header parameters header_params = opts[:header_params] || {} header_params[:'if-generation-match'] = opts[:'if_generation_match'] if !opts[:'if_generation_match'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"KvStoreItemApi.kv_store_delete_item", :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: KvStoreItemApi#kv_store_delete_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#kv_store_get_item(opts = {}) ⇒ String
Get an item. Get an item, including its value, metadata (if any), and generation marker.
99 100 101 102 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 99 def kv_store_get_item(opts = {}) data, _status_code, _headers = kv_store_get_item_with_http_info(opts) data end |
#kv_store_get_item_with_http_info(opts = {}) ⇒ Array<(String, Integer, Hash)>
Get an item. Get an item, including its value, metadata (if any), and generation marker.
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 154 155 156 157 158 159 160 161 162 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 109 def kv_store_get_item_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KvStoreItemApi.kv_store_get_item ...' end # unbox the parameters from the hash store_id = opts[:'store_id'] key = opts[:'key'] # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling KvStoreItemApi.kv_store_get_item" 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 KvStoreItemApi.kv_store_get_item" end # resource path local_var_path = '/resources/stores/kv/{store_id}/keys/{key}'.sub('{' + 'store_id' + '}', CGI.escape(store_id.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'String' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"KvStoreItemApi.kv_store_get_item", :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: KvStoreItemApi#kv_store_get_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#kv_store_list_item_keys(opts = {}) ⇒ InlineResponse2006
List item keys. Lists the matching item keys (or all item keys, if no prefix is supplied).
172 173 174 175 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 172 def kv_store_list_item_keys(opts = {}) data, _status_code, _headers = kv_store_list_item_keys_with_http_info(opts) data end |
#kv_store_list_item_keys_with_http_info(opts = {}) ⇒ Array<(InlineResponse2006, Integer, Hash)>
List item keys. Lists the matching item keys (or all item keys, if no prefix is supplied).
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 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 185 def kv_store_list_item_keys_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KvStoreItemApi.kv_store_list_item_keys ...' end # unbox the parameters from the hash store_id = opts[:'store_id'] # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling KvStoreItemApi.kv_store_list_item_keys" end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling KvStoreItemApi.kv_store_list_item_keys, must be greater than or equal to 1.' end allowable_values = ["strong", "eventual"] if @api_client.config.client_side_validation && opts[:'consistency'] && !allowable_values.include?(opts[:'consistency']) fail ArgumentError, "invalid value for \"consistency\", must be one of #{allowable_values}" end # resource path local_var_path = '/resources/stores/kv/{store_id}/keys'.sub('{' + 'store_id' + '}', CGI.escape(store_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].nil? query_params[:'consistency'] = opts[:'consistency'] if !opts[:'consistency'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'InlineResponse2006' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"KvStoreItemApi.kv_store_list_item_keys", :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: KvStoreItemApi#kv_store_list_item_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#kv_store_upsert_item(opts = {}) ⇒ nil
Insert or update an item. Inserts or updates an item’s value and metadata.
260 261 262 263 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 260 def kv_store_upsert_item(opts = {}) kv_store_upsert_item_with_http_info(opts) nil end |
#kv_store_upsert_item_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>
Insert or update an item. Inserts or updates an item's value and metadata.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 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 |
# File 'lib/fastly/api/kv_store_item_api.rb', line 278 def kv_store_upsert_item_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: KvStoreItemApi.kv_store_upsert_item ...' end # unbox the parameters from the hash store_id = opts[:'store_id'] key = opts[:'key'] # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling KvStoreItemApi.kv_store_upsert_item" 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 KvStoreItemApi.kv_store_upsert_item" end # resource path local_var_path = '/resources/stores/kv/{store_id}/keys/{key}'.sub('{' + 'store_id' + '}', CGI.escape(store_id.to_s)).sub('{' + 'key' + '}', CGI.escape(key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'add'] = opts[:'add'] if !opts[:'add'].nil? query_params[:'append'] = opts[:'append'] if !opts[:'append'].nil? query_params[:'prepend'] = opts[:'prepend'] if !opts[:'prepend'].nil? query_params[:'background_fetch'] = opts[:'background_fetch'] if !opts[:'background_fetch'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/octet-stream']) if !content_type.nil? header_params['Content-Type'] = content_type end header_params[:'if-generation-match'] = opts[:'if_generation_match'] if !opts[:'if_generation_match'].nil? header_params[:'time_to_live_sec'] = opts[:'time_to_live_sec'] if !opts[:'time_to_live_sec'].nil? header_params[:'metadata'] = opts[:'metadata'] if !opts[:'metadata'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"KvStoreItemApi.kv_store_upsert_item", :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: KvStoreItemApi#kv_store_upsert_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |