Class: ApiReference::Backfill

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/backfill.rb

Overview

A backfill represents an update to historical usage data, adding or replacing events in a timeframe.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id:, status:, created_at:, timeframe_start:, timeframe_end:, events_ingested:, close_time:, reverted_at:, customer_id:, replace_existing_events:, deprecation_filter: SKIP, additional_properties: nil) ⇒ Backfill

Returns a new instance of Backfill.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/api_reference/models/backfill.rb', line 98

def initialize(id:, status:, created_at:, timeframe_start:, timeframe_end:,
               events_ingested:, close_time:, reverted_at:, customer_id:,
               replace_existing_events:, deprecation_filter: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @status = status
  @created_at = created_at
  @timeframe_start = timeframe_start
  @timeframe_end = timeframe_end
  @events_ingested = events_ingested
  @close_time = close_time
  @reverted_at = reverted_at
  @customer_id = customer_id
  @deprecation_filter = deprecation_filter unless deprecation_filter == SKIP
  @replace_existing_events = replace_existing_events
  @additional_properties = additional_properties
end

Instance Attribute Details

#close_timeDateTime

If in the future, the time at which the backfill will automatically close. If in the past, the time at which the backfill was closed.

Returns:

  • (DateTime)


41
42
43
# File 'lib/api_reference/models/backfill.rb', line 41

def close_time
  @close_time
end

#created_atDateTime

The status of the backfill.

Returns:

  • (DateTime)


24
25
26
# File 'lib/api_reference/models/backfill.rb', line 24

def created_at
  @created_at
end

#customer_idString

The Orb-generated ID of the customer to which this backfill is scoped. If null, this backfill is scoped to all customers.

Returns:

  • (String)


50
51
52
# File 'lib/api_reference/models/backfill.rb', line 50

def customer_id
  @customer_id
end

#deprecation_filterString

A boolean computed property used to filter the set of events to deprecate

Returns:

  • (String)


56
57
58
# File 'lib/api_reference/models/backfill.rb', line 56

def deprecation_filter
  @deprecation_filter
end

#events_ingestedInteger

The number of events ingested in this backfill.

Returns:

  • (Integer)


36
37
38
# File 'lib/api_reference/models/backfill.rb', line 36

def events_ingested
  @events_ingested
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


16
17
18
# File 'lib/api_reference/models/backfill.rb', line 16

def id
  @id
end

#replace_existing_eventsTrueClass | FalseClass

If true, existing events in the backfill's timeframe will be replaced with the newly ingested events associated with the backfill. If false, newly ingested events will be added to the existing events.

Returns:

  • (TrueClass | FalseClass)


62
63
64
# File 'lib/api_reference/models/backfill.rb', line 62

def replace_existing_events
  @replace_existing_events
end

#reverted_atDateTime

The time at which this backfill was reverted.

Returns:

  • (DateTime)


45
46
47
# File 'lib/api_reference/models/backfill.rb', line 45

def reverted_at
  @reverted_at
end

#statusBackfillStatus

The status of the backfill.

Returns:



20
21
22
# File 'lib/api_reference/models/backfill.rb', line 20

def status
  @status
end

#timeframe_endDateTime

The status of the backfill.

Returns:

  • (DateTime)


32
33
34
# File 'lib/api_reference/models/backfill.rb', line 32

def timeframe_end
  @timeframe_end
end

#timeframe_startDateTime

The status of the backfill.

Returns:

  • (DateTime)


28
29
30
# File 'lib/api_reference/models/backfill.rb', line 28

def timeframe_start
  @timeframe_start
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
169
# File 'lib/api_reference/models/backfill.rb', line 120

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  timeframe_start = if hash.key?('timeframe_start')
                      (DateTimeHelper.from_rfc3339(hash['timeframe_start']) if hash['timeframe_start'])
                    end
  timeframe_end = if hash.key?('timeframe_end')
                    (DateTimeHelper.from_rfc3339(hash['timeframe_end']) if hash['timeframe_end'])
                  end
  events_ingested =
    hash.key?('events_ingested') ? hash['events_ingested'] : nil
  close_time = if hash.key?('close_time')
                 (DateTimeHelper.from_rfc3339(hash['close_time']) if hash['close_time'])
               end
  reverted_at = if hash.key?('reverted_at')
                  (DateTimeHelper.from_rfc3339(hash['reverted_at']) if hash['reverted_at'])
                end
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : nil
  replace_existing_events =
    hash.key?('replace_existing_events') ? hash['replace_existing_events'] : nil
  deprecation_filter =
    hash.key?('deprecation_filter') ? hash['deprecation_filter'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Backfill.new(id: id,
               status: status,
               created_at: created_at,
               timeframe_start: timeframe_start,
               timeframe_end: timeframe_end,
               events_ingested: events_ingested,
               close_time: close_time,
               reverted_at: reverted_at,
               customer_id: customer_id,
               replace_existing_events: replace_existing_events,
               deprecation_filter: deprecation_filter,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/api_reference/models/backfill.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['status'] = 'status'
  @_hash['created_at'] = 'created_at'
  @_hash['timeframe_start'] = 'timeframe_start'
  @_hash['timeframe_end'] = 'timeframe_end'
  @_hash['events_ingested'] = 'events_ingested'
  @_hash['close_time'] = 'close_time'
  @_hash['reverted_at'] = 'reverted_at'
  @_hash['customer_id'] = 'customer_id'
  @_hash['deprecation_filter'] = 'deprecation_filter'
  @_hash['replace_existing_events'] = 'replace_existing_events'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
92
93
94
95
96
# File 'lib/api_reference/models/backfill.rb', line 89

def self.nullables
  %w[
    close_time
    reverted_at
    customer_id
    deprecation_filter
  ]
end

.optionalsObject

An array for optional fields



82
83
84
85
86
# File 'lib/api_reference/models/backfill.rb', line 82

def self.optionals
  %w[
    deprecation_filter
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



203
204
205
206
207
208
209
210
211
212
# File 'lib/api_reference/models/backfill.rb', line 203

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, status: #{@status.inspect}, created_at:"\
  " #{@created_at.inspect}, timeframe_start: #{@timeframe_start.inspect}, timeframe_end:"\
  " #{@timeframe_end.inspect}, events_ingested: #{@events_ingested.inspect}, close_time:"\
  " #{@close_time.inspect}, reverted_at: #{@reverted_at.inspect}, customer_id:"\
  " #{@customer_id.inspect}, deprecation_filter: #{@deprecation_filter.inspect},"\
  " replace_existing_events: #{@replace_existing_events.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_close_timeObject



183
184
185
# File 'lib/api_reference/models/backfill.rb', line 183

def to_custom_close_time
  DateTimeHelper.to_rfc3339(close_time)
end

#to_custom_created_atObject



171
172
173
# File 'lib/api_reference/models/backfill.rb', line 171

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_reverted_atObject



187
188
189
# File 'lib/api_reference/models/backfill.rb', line 187

def to_custom_reverted_at
  DateTimeHelper.to_rfc3339(reverted_at)
end

#to_custom_timeframe_endObject



179
180
181
# File 'lib/api_reference/models/backfill.rb', line 179

def to_custom_timeframe_end
  DateTimeHelper.to_rfc3339(timeframe_end)
end

#to_custom_timeframe_startObject



175
176
177
# File 'lib/api_reference/models/backfill.rb', line 175

def to_custom_timeframe_start
  DateTimeHelper.to_rfc3339(timeframe_start)
end

#to_sObject

Provides a human-readable string representation of the object.



192
193
194
195
196
197
198
199
200
# File 'lib/api_reference/models/backfill.rb', line 192

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, status: #{@status}, created_at: #{@created_at},"\
  " timeframe_start: #{@timeframe_start}, timeframe_end: #{@timeframe_end}, events_ingested:"\
  " #{@events_ingested}, close_time: #{@close_time}, reverted_at: #{@reverted_at},"\
  " customer_id: #{@customer_id}, deprecation_filter: #{@deprecation_filter},"\
  " replace_existing_events: #{@replace_existing_events}, additional_properties:"\
  " #{@additional_properties}>"
end