Class: Fastly::LogRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/fastly/models/log_record.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LogRecord

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/fastly/models/log_record.rb', line 180

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::LogRecord` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::LogRecord`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'customer_id')
    self.customer_id = attributes[:'customer_id']
  end

  if attributes.key?(:'service_id')
    self.service_id = attributes[:'service_id']
  end

  if attributes.key?(:'timestamp')
    self.timestamp = attributes[:'timestamp']
  end

  if attributes.key?(:'client_as_number')
    self.client_as_number = attributes[:'client_as_number']
  end

  if attributes.key?(:'client_region')
    self.client_region = attributes[:'client_region']
  end

  if attributes.key?(:'client_country_code')
    self.client_country_code = attributes[:'client_country_code']
  end

  if attributes.key?(:'client_os_name')
    self.client_os_name = attributes[:'client_os_name']
  end

  if attributes.key?(:'client_device_type')
    self.client_device_type = attributes[:'client_device_type']
  end

  if attributes.key?(:'client_browser_name')
    self.client_browser_name = attributes[:'client_browser_name']
  end

  if attributes.key?(:'client_browser_version')
    self.client_browser_version = attributes[:'client_browser_version']
  end

  if attributes.key?(:'fastly_pop')
    self.fastly_pop = attributes[:'fastly_pop']
  end

  if attributes.key?(:'origin_host')
    self.origin_host = attributes[:'origin_host']
  end

  if attributes.key?(:'request_protocol')
    self.request_protocol = attributes[:'request_protocol']
  end

  if attributes.key?(:'request_host')
    self.request_host = attributes[:'request_host']
  end

  if attributes.key?(:'request_path')
    self.request_path = attributes[:'request_path']
  end

  if attributes.key?(:'request_method')
    self.request_method = attributes[:'request_method']
  end

  if attributes.key?(:'response_bytes_body')
    self.response_bytes_body = attributes[:'response_bytes_body']
  end

  if attributes.key?(:'response_bytes_header')
    self.response_bytes_header = attributes[:'response_bytes_header']
  end

  if attributes.key?(:'response_content_length')
    self.response_content_length = attributes[:'response_content_length']
  end

  if attributes.key?(:'response_content_type')
    self.response_content_type = attributes[:'response_content_type']
  end

  if attributes.key?(:'response_reason')
    self.response_reason = attributes[:'response_reason']
  end

  if attributes.key?(:'response_state')
    self.response_state = attributes[:'response_state']
  end

  if attributes.key?(:'response_status')
    self.response_status = attributes[:'response_status']
  end

  if attributes.key?(:'response_time')
    self.response_time = attributes[:'response_time']
  end

  if attributes.key?(:'response_x_cache')
    self.response_x_cache = attributes[:'response_x_cache']
  end

  if attributes.key?(:'is_cache_hit')
    self.is_cache_hit = attributes[:'is_cache_hit']
  end

  if attributes.key?(:'is_edge')
    self.is_edge = attributes[:'is_edge']
  end

  if attributes.key?(:'is_shield')
    self.is_shield = attributes[:'is_shield']
  end
end

Instance Attribute Details

#client_as_numberObject

The autonomous system (AS) number of the client.



25
26
27
# File 'lib/fastly/models/log_record.rb', line 25

def client_as_number
  @client_as_number
end

#client_browser_nameObject

The name of the browser in use on the client device.



40
41
42
# File 'lib/fastly/models/log_record.rb', line 40

def client_browser_name
  @client_browser_name
end

#client_browser_versionObject

The version of the browser in use on client device.



43
44
45
# File 'lib/fastly/models/log_record.rb', line 43

def client_browser_version
  @client_browser_version
end

#client_country_codeObject

The two-letter ISO 3166-1 country code for the client.



31
32
33
# File 'lib/fastly/models/log_record.rb', line 31

def client_country_code
  @client_country_code
end

#client_device_typeObject

The type of the client’s device.



37
38
39
# File 'lib/fastly/models/log_record.rb', line 37

def client_device_type
  @client_device_type
end

#client_os_nameObject

The name of the operating system installed on the client device.



34
35
36
# File 'lib/fastly/models/log_record.rb', line 34

def client_os_name
  @client_os_name
end

#client_regionObject

The client’s country subdivision code as found in ISO 3166-2.



28
29
30
# File 'lib/fastly/models/log_record.rb', line 28

def client_region
  @client_region
end

#customer_idObject

The ID of the Fastly customer that owns the service.



17
18
19
# File 'lib/fastly/models/log_record.rb', line 17

def customer_id
  @customer_id
end

#fastly_popObject

The name of the Fastly POP that served this request.



46
47
48
# File 'lib/fastly/models/log_record.rb', line 46

def fastly_pop
  @fastly_pop
end

#is_cache_hitObject

Indicates whether this request was fulfilled from cache.



91
92
93
# File 'lib/fastly/models/log_record.rb', line 91

def is_cache_hit
  @is_cache_hit
end

#is_edgeObject

Indicates whether the request was handled by a Fastly edge POP.



94
95
96
# File 'lib/fastly/models/log_record.rb', line 94

def is_edge
  @is_edge
end

#is_shieldObject

Indicates whether the request was handled by a Fastly shield POP.



97
98
99
# File 'lib/fastly/models/log_record.rb', line 97

def is_shield
  @is_shield
end

#origin_hostObject

The name of the origin host that served this request.



49
50
51
# File 'lib/fastly/models/log_record.rb', line 49

def origin_host
  @origin_host
end

#request_hostObject

The name of the request host used for this request.



55
56
57
# File 'lib/fastly/models/log_record.rb', line 55

def request_host
  @request_host
end

#request_methodObject

HTTP method sent by the client such as "GET" or "POST".



61
62
63
# File 'lib/fastly/models/log_record.rb', line 61

def request_method
  @request_method
end

#request_pathObject

The URL path supplied for this request.



58
59
60
# File 'lib/fastly/models/log_record.rb', line 58

def request_path
  @request_path
end

#request_protocolObject

HTTP protocol version in use for this request. For example, HTTP/1.1.



52
53
54
# File 'lib/fastly/models/log_record.rb', line 52

def request_protocol
  @request_protocol
end

#response_bytes_bodyObject

Body bytes sent to the client in the response.



64
65
66
# File 'lib/fastly/models/log_record.rb', line 64

def response_bytes_body
  @response_bytes_body
end

#response_bytes_headerObject

Header bytes sent to the client in the response.



67
68
69
# File 'lib/fastly/models/log_record.rb', line 67

def response_bytes_header
  @response_bytes_header
end

#response_content_lengthObject

Total bytes sent to the client in the response.



70
71
72
# File 'lib/fastly/models/log_record.rb', line 70

def response_content_length
  @response_content_length
end

#response_content_typeObject

The content type of the response sent to the client.



73
74
75
# File 'lib/fastly/models/log_record.rb', line 73

def response_content_type
  @response_content_type
end

#response_reasonObject

The HTTP reason phrase returned for this request, if any.



76
77
78
# File 'lib/fastly/models/log_record.rb', line 76

def response_reason
  @response_reason
end

#response_stateObject

The state of the request with optional suffixes describing special cases.



79
80
81
# File 'lib/fastly/models/log_record.rb', line 79

def response_state
  @response_state
end

#response_statusObject

The HTTP response code returned for this request.



82
83
84
# File 'lib/fastly/models/log_record.rb', line 82

def response_status
  @response_status
end

#response_timeObject

The time since the request started in seconds.



85
86
87
# File 'lib/fastly/models/log_record.rb', line 85

def response_time
  @response_time
end

#response_x_cacheObject

Indicates whether the request was a HIT or a MISS.



88
89
90
# File 'lib/fastly/models/log_record.rb', line 88

def response_x_cache
  @response_x_cache
end

#service_idObject

Returns the value of attribute service_id.



19
20
21
# File 'lib/fastly/models/log_record.rb', line 19

def service_id
  @service_id
end

#timestampObject

Timestamp of the request in ISO 8601 format.



22
23
24
# File 'lib/fastly/models/log_record.rb', line 22

def timestamp
  @timestamp
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



134
135
136
# File 'lib/fastly/models/log_record.rb', line 134

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



100
101
102
103
104
105
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
# File 'lib/fastly/models/log_record.rb', line 100

def self.attribute_map
  {
    :'customer_id' => :'customer_id',
    :'service_id' => :'service_id',
    :'timestamp' => :'timestamp',
    :'client_as_number' => :'client_as_number',
    :'client_region' => :'client_region',
    :'client_country_code' => :'client_country_code',
    :'client_os_name' => :'client_os_name',
    :'client_device_type' => :'client_device_type',
    :'client_browser_name' => :'client_browser_name',
    :'client_browser_version' => :'client_browser_version',
    :'fastly_pop' => :'fastly_pop',
    :'origin_host' => :'origin_host',
    :'request_protocol' => :'request_protocol',
    :'request_host' => :'request_host',
    :'request_path' => :'request_path',
    :'request_method' => :'request_method',
    :'response_bytes_body' => :'response_bytes_body',
    :'response_bytes_header' => :'response_bytes_header',
    :'response_content_length' => :'response_content_length',
    :'response_content_type' => :'response_content_type',
    :'response_reason' => :'response_reason',
    :'response_state' => :'response_state',
    :'response_status' => :'response_status',
    :'response_time' => :'response_time',
    :'response_x_cache' => :'response_x_cache',
    :'is_cache_hit' => :'is_cache_hit',
    :'is_edge' => :'is_edge',
    :'is_shield' => :'is_shield'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



369
370
371
# File 'lib/fastly/models/log_record.rb', line 369

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.fastly_nullableObject

List of attributes with nullable: true



173
174
175
176
# File 'lib/fastly/models/log_record.rb', line 173

def self.fastly_nullable
  Set.new([
  ])
end

.fastly_typesObject

Attribute type mapping.



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
169
170
# File 'lib/fastly/models/log_record.rb', line 139

def self.fastly_types
  {
    :'customer_id' => :'String',
    :'service_id' => :'LogPropertyServiceId',
    :'timestamp' => :'Time',
    :'client_as_number' => :'Integer',
    :'client_region' => :'String',
    :'client_country_code' => :'String',
    :'client_os_name' => :'String',
    :'client_device_type' => :'String',
    :'client_browser_name' => :'String',
    :'client_browser_version' => :'String',
    :'fastly_pop' => :'String',
    :'origin_host' => :'String',
    :'request_protocol' => :'String',
    :'request_host' => :'String',
    :'request_path' => :'String',
    :'request_method' => :'String',
    :'response_bytes_body' => :'Integer',
    :'response_bytes_header' => :'Integer',
    :'response_content_length' => :'Integer',
    :'response_content_type' => :'String',
    :'response_reason' => :'String',
    :'response_state' => :'String',
    :'response_status' => :'Integer',
    :'response_time' => :'Float',
    :'response_x_cache' => :'String',
    :'is_cache_hit' => :'Boolean',
    :'is_edge' => :'Boolean',
    :'is_shield' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/fastly/models/log_record.rb', line 321

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      customer_id == o.customer_id &&
      service_id == o.service_id &&
      timestamp == o.timestamp &&
      client_as_number == o.client_as_number &&
      client_region == o.client_region &&
      client_country_code == o.client_country_code &&
      client_os_name == o.client_os_name &&
      client_device_type == o.client_device_type &&
      client_browser_name == o.client_browser_name &&
      client_browser_version == o.client_browser_version &&
      fastly_pop == o.fastly_pop &&
      origin_host == o.origin_host &&
      request_protocol == o.request_protocol &&
      request_host == o.request_host &&
      request_path == o.request_path &&
      request_method == o.request_method &&
      response_bytes_body == o.response_bytes_body &&
      response_bytes_header == o.response_bytes_header &&
      response_content_length == o.response_content_length &&
      response_content_type == o.response_content_type &&
      response_reason == o.response_reason &&
      response_state == o.response_state &&
      response_status == o.response_status &&
      response_time == o.response_time &&
      response_x_cache == o.response_x_cache &&
      is_cache_hit == o.is_cache_hit &&
      is_edge == o.is_edge &&
      is_shield == o.is_shield
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/fastly/models/log_record.rb', line 399

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Fastly.const_get(type)
    klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/fastly/models/log_record.rb', line 470

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/fastly/models/log_record.rb', line 376

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.fastly_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


356
357
358
# File 'lib/fastly/models/log_record.rb', line 356

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



362
363
364
# File 'lib/fastly/models/log_record.rb', line 362

def hash
  [customer_id, service_id, timestamp, client_as_number, client_region, client_country_code, client_os_name, client_device_type, client_browser_name, client_browser_version, fastly_pop, origin_host, request_protocol, request_host, request_path, request_method, response_bytes_body, response_bytes_header, response_content_length, response_content_type, response_reason, response_state, response_status, response_time, response_x_cache, is_cache_hit, is_edge, is_shield].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



308
309
310
311
# File 'lib/fastly/models/log_record.rb', line 308

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



446
447
448
# File 'lib/fastly/models/log_record.rb', line 446

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/fastly/models/log_record.rb', line 452

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.fastly_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



440
441
442
# File 'lib/fastly/models/log_record.rb', line 440

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



315
316
317
# File 'lib/fastly/models/log_record.rb', line 315

def valid?
  true
end