Class: Fastly::WafActiveRulesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/fastly/api/waf_active_rules_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WafActiveRulesApi

Returns a new instance of WafActiveRulesApi.



17
18
19
# File 'lib/fastly/api/waf_active_rules_api.rb', line 17

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



15
16
17
# File 'lib/fastly/api/waf_active_rules_api.rb', line 15

def api_client
  @api_client
end

Instance Method Details

#bulk_delete_waf_active_rules(opts = {}) ⇒ nil

Delete multiple active rules from a WAF Delete many active rules on a particular firewall version using the active rule ID. Limited to 500 rules per request.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :request_body (Hash<String, Object>)

Returns:

  • (nil)


26
27
28
29
# File 'lib/fastly/api/waf_active_rules_api.rb', line 26

def bulk_delete_waf_active_rules(opts = {})
  bulk_delete_waf_active_rules_with_http_info(opts)
  nil
end

#bulk_delete_waf_active_rules_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete multiple active rules from a WAF Delete many active rules on a particular firewall version using the active rule ID. Limited to 500 rules per request.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :request_body (Hash<String, Object>)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



37
38
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
# File 'lib/fastly/api/waf_active_rules_api.rb', line 37

def bulk_delete_waf_active_rules_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.bulk_delete_waf_active_rules ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.bulk_delete_waf_active_rules"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.bulk_delete_waf_active_rules"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json; ext=bulk'])
  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(opts[:'request_body'])

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.bulk_delete_waf_active_rules",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#bulk_delete_waf_active_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#bulk_update_waf_active_rules(opts = {}) ⇒ nil

Update multiple active rules Bulk update all active rules on a [firewall version](www.fastly.com/documentation/reference/api/waf/firewall-version/). This endpoint will not add new active rules, only update existing active rules.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :body (WafActiveRuleData)

Returns:

  • (nil)


101
102
103
104
# File 'lib/fastly/api/waf_active_rules_api.rb', line 101

def bulk_update_waf_active_rules(opts = {})
  bulk_update_waf_active_rules_with_http_info(opts)
  nil
end

#bulk_update_waf_active_rules_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Update multiple active rules Bulk update all active rules on a [firewall version](www.fastly.com/documentation/reference/api/waf/firewall-version/). This endpoint will not add new active rules, only update existing active rules.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :body (WafActiveRuleData)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



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
163
164
165
166
167
168
# File 'lib/fastly/api/waf_active_rules_api.rb', line 112

def bulk_update_waf_active_rules_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.bulk_update_waf_active_rules ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.bulk_update_waf_active_rules"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.bulk_update_waf_active_rules"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/bulk'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+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(opts[:'body'])

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.bulk_update_waf_active_rules",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#bulk_update_waf_active_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_waf_active_rule(opts = {}) ⇒ WafActiveRuleCreationResponse

Add a rule to a WAF as an active rule Create an active rule for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_active_rule (WafActiveRule)

Returns:



176
177
178
179
# File 'lib/fastly/api/waf_active_rules_api.rb', line 176

def create_waf_active_rule(opts = {})
  data, _status_code, _headers = create_waf_active_rule_with_http_info(opts)
  data
end

#create_waf_active_rule_with_http_info(opts = {}) ⇒ Array<(WafActiveRuleCreationResponse, Integer, Hash)>

Add a rule to a WAF as an active rule Create an active rule for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_active_rule (WafActiveRule)

Returns:



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/waf_active_rules_api.rb', line 187

def create_waf_active_rule_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.create_waf_active_rule ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.create_waf_active_rule"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.create_waf_active_rule"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_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/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+json', 'application/vnd.api+json; ext=bulk'])
  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(opts[:'waf_active_rule'])

  # return_type
  return_type = opts[:debug_return_type] || 'WafActiveRuleCreationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.create_waf_active_rule",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#create_waf_active_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_waf_active_rules_tag(opts = {}) ⇒ nil

Create active rules by tag Create active rules by tag. This endpoint will create active rules using the latest revision available for each rule.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_tag_name (String)

    Name of the tag. (required)

  • :waf_active_rule (WafActiveRule)

Returns:

  • (nil)


254
255
256
257
# File 'lib/fastly/api/waf_active_rules_api.rb', line 254

def create_waf_active_rules_tag(opts = {})
  create_waf_active_rules_tag_with_http_info(opts)
  nil
end

#create_waf_active_rules_tag_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create active rules by tag Create active rules by tag. This endpoint will create active rules using the latest revision available for each rule.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_tag_name (String)

    Name of the tag. (required)

  • :waf_active_rule (WafActiveRule)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



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
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
# File 'lib/fastly/api/waf_active_rules_api.rb', line 266

def create_waf_active_rules_tag_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.create_waf_active_rules_tag ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  waf_tag_name = opts[:'waf_tag_name']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.create_waf_active_rules_tag"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.create_waf_active_rules_tag"
  end
  # verify the required parameter 'waf_tag_name' is set
  if @api_client.config.client_side_validation && waf_tag_name.nil?
    fail ArgumentError, "Missing the required parameter 'waf_tag_name' when calling WafActiveRulesApi.create_waf_active_rules_tag"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/tags/{waf_tag_name}/active-rules'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'waf_tag_name' + '}', CGI.escape(waf_tag_name.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+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(opts[:'waf_active_rule'])

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.create_waf_active_rules_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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#create_waf_active_rules_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_waf_active_rule(opts = {}) ⇒ nil

Delete an active rule Delete an active rule for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_rule_id (String)

    Alphanumeric string identifying a WAF rule. (required)

Returns:

  • (nil)


335
336
337
338
# File 'lib/fastly/api/waf_active_rules_api.rb', line 335

def delete_waf_active_rule(opts = {})
  delete_waf_active_rule_with_http_info(opts)
  nil
end

#delete_waf_active_rule_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete an active rule Delete an active rule for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_rule_id (String)

    Alphanumeric string identifying a WAF rule. (required)

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/fastly/api/waf_active_rules_api.rb', line 346

def delete_waf_active_rule_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.delete_waf_active_rule ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  waf_rule_id = opts[:'waf_rule_id']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.delete_waf_active_rule"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.delete_waf_active_rule"
  end
  # verify the required parameter 'waf_rule_id' is set
  if @api_client.config.client_side_validation && waf_rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'waf_rule_id' when calling WafActiveRulesApi.delete_waf_active_rule"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/{waf_rule_id}'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'waf_rule_id' + '}', CGI.escape(waf_rule_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # 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']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.delete_waf_active_rule",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#delete_waf_active_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_waf_active_rule(opts = {}) ⇒ WafActiveRuleResponse

Get an active WAF rule object Get a specific active rule object. Includes details of the rule revision associated with the active rule object by default.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_rule_id (String)

    Alphanumeric string identifying a WAF rule. (required)

  • :include (String)

    Include relationships. Optional, comma-separated values. Permitted values: &#x60;waf_rule_revision&#x60; and &#x60;waf_firewall_version&#x60;.

Returns:



411
412
413
414
# File 'lib/fastly/api/waf_active_rules_api.rb', line 411

def get_waf_active_rule(opts = {})
  data, _status_code, _headers = get_waf_active_rule_with_http_info(opts)
  data
end

#get_waf_active_rule_with_http_info(opts = {}) ⇒ Array<(WafActiveRuleResponse, Integer, Hash)>

Get an active WAF rule object Get a specific active rule object. Includes details of the rule revision associated with the active rule object by default.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_rule_id (String)

    Alphanumeric string identifying a WAF rule. (required)

  • :include (String)

    Include relationships. Optional, comma-separated values. Permitted values: &#x60;waf_rule_revision&#x60; and &#x60;waf_firewall_version&#x60;.

Returns:

  • (Array<(WafActiveRuleResponse, Integer, Hash)>)

    WafActiveRuleResponse data, response status code and response headers



423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/fastly/api/waf_active_rules_api.rb', line 423

def get_waf_active_rule_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.get_waf_active_rule ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  waf_rule_id = opts[:'waf_rule_id']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.get_waf_active_rule"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.get_waf_active_rule"
  end
  # verify the required parameter 'waf_rule_id' is set
  if @api_client.config.client_side_validation && waf_rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'waf_rule_id' when calling WafActiveRulesApi.get_waf_active_rule"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/{waf_rule_id}'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'waf_rule_id' + '}', CGI.escape(waf_rule_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'WafActiveRuleResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.get_waf_active_rule",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#get_waf_active_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_waf_active_rules(opts = {}) ⇒ WafActiveRulesResponse

List active rules on a WAF List all active rules for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :filter_status (String)

    Limit results to active rules with the specified status.

  • :filter_waf_rule_revision_message (String)

    Limit results to active rules with the specified message.

  • :filter_waf_rule_revision_modsec_rule_id (String)

    Limit results to active rules that represent the specified ModSecurity modsec_rule_id.

  • :filter_outdated (String)

    Limit results to active rules referencing an outdated rule revision.

  • :include (String)

    Include relationships. Optional, comma-separated values. Permitted values: &#x60;waf_rule_revision&#x60; and &#x60;waf_firewall_version&#x60;.

  • :page_number (Integer)

    Current page.

  • :page_size (Integer)

    Number of records per page. (default to 20)

Returns:



496
497
498
499
# File 'lib/fastly/api/waf_active_rules_api.rb', line 496

def list_waf_active_rules(opts = {})
  data, _status_code, _headers = list_waf_active_rules_with_http_info(opts)
  data
end

#list_waf_active_rules_with_http_info(opts = {}) ⇒ Array<(WafActiveRulesResponse, Integer, Hash)>

List active rules on a WAF List all active rules for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :filter_status (String)

    Limit results to active rules with the specified status.

  • :filter_waf_rule_revision_message (String)

    Limit results to active rules with the specified message.

  • :filter_waf_rule_revision_modsec_rule_id (String)

    Limit results to active rules that represent the specified ModSecurity modsec_rule_id.

  • :filter_outdated (String)

    Limit results to active rules referencing an outdated rule revision.

  • :include (String)

    Include relationships. Optional, comma-separated values. Permitted values: &#x60;waf_rule_revision&#x60; and &#x60;waf_firewall_version&#x60;.

  • :page_number (Integer)

    Current page.

  • :page_size (Integer)

    Number of records per page. (default to 20)

Returns:

  • (Array<(WafActiveRulesResponse, Integer, Hash)>)

    WafActiveRulesResponse data, response status code and response headers



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/fastly/api/waf_active_rules_api.rb', line 513

def list_waf_active_rules_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.list_waf_active_rules ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling WafActiveRulesApi.list_waf_active_rules, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling WafActiveRulesApi.list_waf_active_rules, must be greater than or equal to 1.'
  end

  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.list_waf_active_rules"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.list_waf_active_rules"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[status]'] = opts[:'filter_status'] if !opts[:'filter_status'].nil?
  query_params[:'filter[waf_rule_revision][message]'] = opts[:'filter_waf_rule_revision_message'] if !opts[:'filter_waf_rule_revision_message'].nil?
  query_params[:'filter[waf_rule_revision][modsec_rule_id]'] = opts[:'filter_waf_rule_revision_modsec_rule_id'] if !opts[:'filter_waf_rule_revision_modsec_rule_id'].nil?
  query_params[:'filter[outdated]'] = opts[:'filter_outdated'] if !opts[:'filter_outdated'].nil?
  query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil?
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'WafActiveRulesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.list_waf_active_rules",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#list_waf_active_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_waf_active_rule(opts = {}) ⇒ WafActiveRuleResponse

Update an active rule Update an active rule’s status for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_rule_id (String)

    Alphanumeric string identifying a WAF rule. (required)

  • :waf_active_rule (WafActiveRule)

Returns:



590
591
592
593
# File 'lib/fastly/api/waf_active_rules_api.rb', line 590

def update_waf_active_rule(opts = {})
  data, _status_code, _headers = update_waf_active_rule_with_http_info(opts)
  data
end

#update_waf_active_rule_with_http_info(opts = {}) ⇒ Array<(WafActiveRuleResponse, Integer, Hash)>

Update an active rule Update an active rule&#39;s status for a particular firewall version.

Parameters:

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :firewall_id (String)

    Alphanumeric string identifying a WAF Firewall. (required)

  • :version_id (Integer)

    Integer identifying a service version. (required)

  • :waf_rule_id (String)

    Alphanumeric string identifying a WAF rule. (required)

  • :waf_active_rule (WafActiveRule)

Returns:

  • (Array<(WafActiveRuleResponse, Integer, Hash)>)

    WafActiveRuleResponse data, response status code and response headers



602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/fastly/api/waf_active_rules_api.rb', line 602

def update_waf_active_rule_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WafActiveRulesApi.update_waf_active_rule ...'
  end
  # unbox the parameters from the hash
  firewall_id = opts[:'firewall_id']
  version_id = opts[:'version_id']
  waf_rule_id = opts[:'waf_rule_id']
  # verify the required parameter 'firewall_id' is set
  if @api_client.config.client_side_validation && firewall_id.nil?
    fail ArgumentError, "Missing the required parameter 'firewall_id' when calling WafActiveRulesApi.update_waf_active_rule"
  end
  # verify the required parameter 'version_id' is set
  if @api_client.config.client_side_validation && version_id.nil?
    fail ArgumentError, "Missing the required parameter 'version_id' when calling WafActiveRulesApi.update_waf_active_rule"
  end
  # verify the required parameter 'waf_rule_id' is set
  if @api_client.config.client_side_validation && waf_rule_id.nil?
    fail ArgumentError, "Missing the required parameter 'waf_rule_id' when calling WafActiveRulesApi.update_waf_active_rule"
  end
  # resource path
  local_var_path = '/waf/firewalls/{firewall_id}/versions/{version_id}/active-rules/{waf_rule_id}'.sub('{' + 'firewall_id' + '}', CGI.escape(firewall_id.to_s)).sub('{' + 'version_id' + '}', CGI.escape(version_id.to_s)).sub('{' + 'waf_rule_id' + '}', CGI.escape(waf_rule_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/vnd.api+json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/vnd.api+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(opts[:'waf_active_rule'])

  # return_type
  return_type = opts[:debug_return_type] || 'WafActiveRuleResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['token']

  new_options = opts.merge(
    :operation => :"WafActiveRulesApi.update_waf_active_rule",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WafActiveRulesApi#update_waf_active_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end