Class: SmplkitGeneratedClient::Audit::Forwarder

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb

Overview

A destination that receives audit events recorded for the account. Each event recorded for the account is evaluated against every enabled forwarder. If the filter expression evaluates truthy — or is absent — the event is shaped by the configured transform and delivered to the destination defined by “configuration“.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ Forwarder

Initializes the object

Parameters:

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

    Model attributes in the form of hash



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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
224
225
226
227
228
229
230
231
232
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 149

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

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

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

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

  if attributes.key?(:'forwarder_type')
    self.forwarder_type = attributes[:'forwarder_type']
  else
    self.forwarder_type = nil
  end

  if attributes.key?(:'enabled')
    self.enabled = attributes[:'enabled']
  else
    self.enabled = false
  end

  if attributes.key?(:'forward_smplkit_events')
    self.forward_smplkit_events = attributes[:'forward_smplkit_events']
  else
    self.forward_smplkit_events = false
  end

  if attributes.key?(:'filter')
    if (value = attributes[:'filter']).is_a?(Hash)
      self.filter = value
    end
  end

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

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

  if attributes.key?(:'configuration')
    self.configuration = attributes[:'configuration']
  else
    self.configuration = nil
  end

  if attributes.key?(:'environments')
    if (value = attributes[:'environments']).is_a?(Hash)
      self.environments = value
    end
  end

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

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

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

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

Instance Attribute Details

#configurationObject

Base delivery configuration template. Shape is discriminated by “forwarder_type“; today all destination types use “HttpConfiguration“. Branded vendor types (everything except ‘http`) constrain the configuration against a per-vendor template — see `GET /api/v1/forwarder_types` for the URL pattern, fixed headers, and customer-supplied placeholders for each type. A per-environment override in `environments` replaces this template for that environment.



44
45
46
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 44

def configuration
  @configuration
end

#created_atObject

When the forwarder was created.



50
51
52
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 50

def created_at
  @created_at
end

#deleted_atObject

When the forwarder was deleted. ‘null` for active forwarders.



56
57
58
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 56

def deleted_at
  @deleted_at
end

#descriptionObject

Free-text description for the forwarder.



23
24
25
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 23

def description
  @description
end

#enabledObject

Always false. Enablement is per-environment: a forwarder delivers in an environment only when ‘environments.enabled` is true. The base value is pinned false and cannot be set.



29
30
31
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 29

def enabled
  @enabled
end

#environmentsObject

Per-environment overrides keyed by environment key (e.g. ‘production`, `staging`). Each entry sets `enabled` (whether the forwarder delivers in that environment) and an optional `configuration` override (omit to inherit the base `configuration`). A forwarder with no entry for an environment is disabled there. Every referenced environment must exist and be managed for the account.



47
48
49
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 47

def environments
  @environments
end

#filterObject

JSON Logic expression evaluated against each event. The event is delivered only if the expression returns truthy. Omit to deliver every event.



35
36
37
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 35

def filter
  @filter
end

#forward_smplkit_eventsObject

When true, this forwarder also receives platform change events that smplkit records about your own resources (flag, configuration, and similar changes). Each such event is delivered through every environment this forwarder is enabled in, using that environment’s resolved configuration. Defaults to false — platform change events are not forwarded unless you opt in. Independent of the per-environment ‘enabled` settings, since platform change events are not tied to a deployment environment.



32
33
34
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 32

def forward_smplkit_events
  @forward_smplkit_events
end

#forwarder_typeObject

Destination type.



26
27
28
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 26

def forwarder_type
  @forwarder_type
end

#nameObject

Human-readable name for the forwarder. Must contain at least one non-whitespace character.



20
21
22
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 20

def name
  @name
end

#transformObject

Template applied to each event before delivery. The shape depends on “transform_type“: for ‘JSONATA`, a string containing a JSONata expression. Omit to deliver the event JSON unchanged.



41
42
43
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 41

def transform
  @transform
end

#transform_typeObject

Engine used to evaluate “transform“. Must be set whenever “transform“ is set. Today only ‘JSONATA` is supported.



38
39
40
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 38

def transform_type
  @transform_type
end

#updated_atObject

When the forwarder was last modified.



53
54
55
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 53

def updated_at
  @updated_at
end

#versionObject

Monotonic counter incremented on every update, starting at 1.



59
60
61
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 59

def version
  @version
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



104
105
106
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 104

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



109
110
111
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 109

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 84

def self.attribute_map
  {
    :'name' => :'name',
    :'description' => :'description',
    :'forwarder_type' => :'forwarder_type',
    :'enabled' => :'enabled',
    :'forward_smplkit_events' => :'forward_smplkit_events',
    :'filter' => :'filter',
    :'transform_type' => :'transform_type',
    :'transform' => :'transform',
    :'configuration' => :'configuration',
    :'environments' => :'environments',
    :'created_at' => :'created_at',
    :'updated_at' => :'updated_at',
    :'deleted_at' => :'deleted_at',
    :'version' => :'version'
  }
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



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 375

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 134

def self.openapi_nullable
  Set.new([
    :'description',
    :'filter',
    :'transform_type',
    :'transform',
    :'created_at',
    :'updated_at',
    :'deleted_at',
    :'version'
  ])
end

.openapi_typesObject

Attribute type mapping.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 114

def self.openapi_types
  {
    :'name' => :'String',
    :'description' => :'String',
    :'forwarder_type' => :'ForwarderType',
    :'enabled' => :'Boolean',
    :'forward_smplkit_events' => :'Boolean',
    :'filter' => :'Hash<String, Object>',
    :'transform_type' => :'String',
    :'transform' => :'Object',
    :'configuration' => :'HttpConfiguration',
    :'environments' => :'Hash<String, ForwarderEnvironment>',
    :'created_at' => :'Time',
    :'updated_at' => :'Time',
    :'deleted_at' => :'Time',
    :'version' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 341

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      description == o.description &&
      forwarder_type == o.forwarder_type &&
      enabled == o.enabled &&
      forward_smplkit_events == o.forward_smplkit_events &&
      filter == o.filter &&
      transform_type == o.transform_type &&
      transform == o.transform &&
      configuration == o.configuration &&
      environments == o.environments &&
      created_at == o.created_at &&
      updated_at == o.updated_at &&
      deleted_at == o.deleted_at &&
      version == o.version
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


362
363
364
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 362

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



368
369
370
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 368

def hash
  [name, description, forwarder_type, enabled, forward_smplkit_events, filter, transform_type, transform, configuration, environments, created_at, updated_at, deleted_at, version].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 236

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @name.to_s.length > 200
    invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
  end

  if @name.to_s.length < 1
    invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
  end

  if !@description.nil? && @description.to_s.length > 2000
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 2000.')
  end

  if @forwarder_type.nil?
    invalid_properties.push('invalid value for "forwarder_type", forwarder_type cannot be nil.')
  end

  if @configuration.nil?
    invalid_properties.push('invalid value for "configuration", configuration cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 397

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

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/forwarder.rb', line 268

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @name.nil?
  return false if @name.to_s.length > 200
  return false if @name.to_s.length < 1
  return false if !@description.nil? && @description.to_s.length > 2000
  return false if @forwarder_type.nil?
  transform_type_validator = EnumAttributeValidator.new('String', ["JSONATA"])
  return false unless transform_type_validator.valid?(@transform_type)
  return false if @configuration.nil?
  true
end