Class: Fastly::PurgeApi
- Inherits:
-
Object
- Object
- Fastly::PurgeApi
- Defined in:
- lib/fastly/api/purge_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#bulk_purge_tag(opts = {}) ⇒ Hash<String, String>
Purge multiple surrogate key tags Instant Purge a particular service of items tagged with surrogate keys.
-
#bulk_purge_tag_with_http_info(opts = {}) ⇒ Array<(Hash<String, String>, Integer, Hash)>
Purge multiple surrogate key tags Instant Purge a particular service of items tagged with surrogate keys.
-
#initialize(api_client = ApiClient.default) ⇒ PurgeApi
constructor
A new instance of PurgeApi.
-
#purge_all(opts = {}) ⇒ InlineResponse200
Purge everything from a service Instant Purge everything from a service.
-
#purge_all_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>
Purge everything from a service Instant Purge everything from a service.
-
#purge_single_url(opts = {}) ⇒ PurgeResponse
Purge a URL Instant Purge an individual URL.
-
#purge_single_url_with_http_info(opts = {}) ⇒ Array<(PurgeResponse, Integer, Hash)>
Purge a URL Instant Purge an individual URL.
-
#purge_tag(opts = {}) ⇒ PurgeResponse
Purge by surrogate key tag Instant Purge a particular service of items tagged with a Surrogate Key.
-
#purge_tag_with_http_info(opts = {}) ⇒ Array<(PurgeResponse, Integer, Hash)>
Purge by surrogate key tag Instant Purge a particular service of items tagged with a Surrogate Key.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
15 16 17 |
# File 'lib/fastly/api/purge_api.rb', line 15 def api_client @api_client end |
Instance Method Details
#bulk_purge_tag(opts = {}) ⇒ Hash<String, String>
Purge multiple surrogate key tags Instant Purge a particular service of items tagged with surrogate keys. Up to 256 surrogate keys can be purged in one batch request. As an alternative to sending the keys in a JSON object in the body of the request, this endpoint also supports listing keys in a Surrogate-Key
request header, e.g. Surrogate-Key: key_1 key_2 key_3
.
27 28 29 30 |
# File 'lib/fastly/api/purge_api.rb', line 27 def bulk_purge_tag(opts = {}) data, _status_code, _headers = bulk_purge_tag_with_http_info(opts) data end |
#bulk_purge_tag_with_http_info(opts = {}) ⇒ Array<(Hash<String, String>, Integer, Hash)>
Purge multiple surrogate key tags Instant Purge a particular service of items tagged with surrogate keys. Up to 256 surrogate keys can be purged in one batch request. As an alternative to sending the keys in a JSON object in the body of the request, this endpoint also supports listing keys in a <code>Surrogate-Key</code> request header, e.g. <code>Surrogate-Key: key_1 key_2 key_3</code>.
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 93 94 |
# File 'lib/fastly/api/purge_api.rb', line 39 def bulk_purge_tag_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PurgeApi.bulk_purge_tag ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling PurgeApi.bulk_purge_tag" end # resource path local_var_path = '/service/{service_id}/purge'.sub('{' + 'service_id' + '}', CGI.escape(service_id.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/json']) # 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 header_params[:'fastly-soft-purge'] = opts[:'fastly_soft_purge'] if !opts[:'fastly_soft_purge'].nil? header_params[:'surrogate-key'] = opts[:'surrogate_key'] if !opts[:'surrogate_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'purge_response']) # return_type return_type = opts[:debug_return_type] || 'Hash<String, String>' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"PurgeApi.bulk_purge_tag", :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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: PurgeApi#bulk_purge_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#purge_all(opts = {}) ⇒ InlineResponse200
Purge everything from a service Instant Purge everything from a service. Purge-all requests cannot be done in soft mode and will always immediately invalidate all cached content associated with the service. To do a soft-purge-all, consider applying a constant [surrogate key](docs.fastly.com/en/guides/getting-started-with-surrogate-keys) tag (e.g., ‘"all"`) to all objects.
100 101 102 103 |
# File 'lib/fastly/api/purge_api.rb', line 100 def purge_all(opts = {}) data, _status_code, _headers = purge_all_with_http_info(opts) data end |
#purge_all_with_http_info(opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>
Purge everything from a service Instant Purge everything from a service. Purge-all requests cannot be done in soft mode and will always immediately invalidate all cached content associated with the service. To do a soft-purge-all, consider applying a constant [surrogate key](docs.fastly.com/en/guides/getting-started-with-surrogate-keys) tag (e.g., `"all"`) to all objects.
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 |
# File 'lib/fastly/api/purge_api.rb', line 109 def purge_all_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PurgeApi.purge_all ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling PurgeApi.purge_all" end # resource path local_var_path = '/service/{service_id}/purge_all'.sub('{' + 'service_id' + '}', CGI.escape(service_id.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/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'InlineResponse200' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"PurgeApi.purge_all", :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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: PurgeApi#purge_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#purge_single_url(opts = {}) ⇒ PurgeResponse
Purge a URL Instant Purge an individual URL.
164 165 166 167 |
# File 'lib/fastly/api/purge_api.rb', line 164 def purge_single_url(opts = {}) data, _status_code, _headers = purge_single_url_with_http_info(opts) data end |
#purge_single_url_with_http_info(opts = {}) ⇒ Array<(PurgeResponse, Integer, Hash)>
Purge a URL Instant Purge an individual URL.
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 220 221 222 223 |
# File 'lib/fastly/api/purge_api.rb', line 174 def purge_single_url_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PurgeApi.purge_single_url ...' end # unbox the parameters from the hash cached_url = opts[:'cached_url'] # verify the required parameter 'cached_url' is set if @api_client.config.client_side_validation && cached_url.nil? fail ArgumentError, "Missing the required parameter 'cached_url' when calling PurgeApi.purge_single_url" end # resource path local_var_path = '/purge/{cached_url}'.sub('{' + 'cached_url' + '}', cached_url.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/json']) header_params[:'fastly-soft-purge'] = opts[:'fastly_soft_purge'] if !opts[:'fastly_soft_purge'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'PurgeResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"PurgeApi.purge_single_url", :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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: PurgeApi#purge_single_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#purge_tag(opts = {}) ⇒ PurgeResponse
Purge by surrogate key tag Instant Purge a particular service of items tagged with a Surrogate Key. Only one surrogate key can be purged at a time. Multiple keys can be purged using a batch surrogate key purge request.
231 232 233 234 |
# File 'lib/fastly/api/purge_api.rb', line 231 def purge_tag(opts = {}) data, _status_code, _headers = purge_tag_with_http_info(opts) data end |
#purge_tag_with_http_info(opts = {}) ⇒ Array<(PurgeResponse, Integer, Hash)>
Purge by surrogate key tag Instant Purge a particular service of items tagged with a Surrogate Key. Only one surrogate key can be purged at a time. Multiple keys can be purged using a batch surrogate key purge request.
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 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/fastly/api/purge_api.rb', line 242 def purge_tag_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PurgeApi.purge_tag ...' end # unbox the parameters from the hash service_id = opts[:'service_id'] surrogate_key = opts[:'surrogate_key'] # verify the required parameter 'service_id' is set if @api_client.config.client_side_validation && service_id.nil? fail ArgumentError, "Missing the required parameter 'service_id' when calling PurgeApi.purge_tag" end # verify the required parameter 'surrogate_key' is set if @api_client.config.client_side_validation && surrogate_key.nil? fail ArgumentError, "Missing the required parameter 'surrogate_key' when calling PurgeApi.purge_tag" end # resource path local_var_path = '/service/{service_id}/purge/{surrogate_key}'.sub('{' + 'service_id' + '}', CGI.escape(service_id.to_s)).sub('{' + 'surrogate_key' + '}', surrogate_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/json']) header_params[:'fastly-soft-purge'] = opts[:'fastly_soft_purge'] if !opts[:'fastly_soft_purge'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'PurgeResponse' # auth_names auth_names = opts[:debug_auth_names] || ['token'] = opts.merge( :operation => :"PurgeApi.purge_tag", :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(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: PurgeApi#purge_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |