Class: OCI::CloudGuard::Models::CreateDetectorRuleDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_guard/models/create_detector_rule_details.rb

Overview

Details of a detector rule to be created in a detector recipe.

Constant Summary collapse

RISK_LEVEL_ENUM =
[
  RISK_LEVEL_CRITICAL = 'CRITICAL'.freeze,
  RISK_LEVEL_HIGH = 'HIGH'.freeze,
  RISK_LEVEL_MEDIUM = 'MEDIUM'.freeze,
  RISK_LEVEL_LOW = 'LOW'.freeze,
  RISK_LEVEL_MINOR = 'MINOR'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CreateDetectorRuleDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 117

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.source_detector_rule_id = attributes[:'sourceDetectorRuleId'] if attributes[:'sourceDetectorRuleId']

  raise 'You cannot provide both :sourceDetectorRuleId and :source_detector_rule_id' if attributes.key?(:'sourceDetectorRuleId') && attributes.key?(:'source_detector_rule_id')

  self.source_detector_rule_id = attributes[:'source_detector_rule_id'] if attributes[:'source_detector_rule_id']

  self.name = attributes[:'name'] if attributes[:'name']

  self.description = attributes[:'description'] if attributes[:'description']

  self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil?
  self.is_enabled = false if is_enabled.nil? && !attributes.key?(:'isEnabled') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled')

  self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil?
  self.is_enabled = false if is_enabled.nil? && !attributes.key?(:'isEnabled') && !attributes.key?(:'is_enabled') # rubocop:disable Style/StringLiterals

  self.risk_level = attributes[:'riskLevel'] if attributes[:'riskLevel']

  raise 'You cannot provide both :riskLevel and :risk_level' if attributes.key?(:'riskLevel') && attributes.key?(:'risk_level')

  self.risk_level = attributes[:'risk_level'] if attributes[:'risk_level']

  self.configurations = attributes[:'configurations'] if attributes[:'configurations']

  self.condition = attributes[:'condition'] if attributes[:'condition']

  self.labels = attributes[:'labels'] if attributes[:'labels']

  self.recommendation = attributes[:'recommendation'] if attributes[:'recommendation']

  self.data_source_id = attributes[:'dataSourceId'] if attributes[:'dataSourceId']

  raise 'You cannot provide both :dataSourceId and :data_source_id' if attributes.key?(:'dataSourceId') && attributes.key?(:'data_source_id')

  self.data_source_id = attributes[:'data_source_id'] if attributes[:'data_source_id']

  self.entities_mappings = attributes[:'entitiesMappings'] if attributes[:'entitiesMappings']

  raise 'You cannot provide both :entitiesMappings and :entities_mappings' if attributes.key?(:'entitiesMappings') && attributes.key?(:'entities_mappings')

  self.entities_mappings = attributes[:'entities_mappings'] if attributes[:'entities_mappings']
end

Instance Attribute Details

#conditionOCI::CloudGuard::Models::Condition



44
45
46
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 44

def condition
  @condition
end

#configurationsArray<OCI::CloudGuard::Models::DetectorConfiguration>

List of detector rule configurations



41
42
43
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 41

def configurations
  @configurations
end

#data_source_idString

OCID of the data source which is attached

Returns:

  • (String)


56
57
58
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 56

def data_source_id
  @data_source_id
end

#descriptionString

Description of the detector rule

Returns:

  • (String)


29
30
31
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 29

def description
  @description
end

#entities_mappingsArray<OCI::CloudGuard::Models::EntitiesMapping>

Data source entities mapping for the detector rule



60
61
62
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 60

def entities_mappings
  @entities_mappings
end

#is_enabledBOOLEAN

Enablement state of the detector rule

Returns:

  • (BOOLEAN)


33
34
35
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 33

def is_enabled
  @is_enabled
end

#labelsArray<String>

User-defined labels for the detector rule

Returns:

  • (Array<String>)


48
49
50
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 48

def labels
  @labels
end

#nameString

[Required] Name of the detector rule

Returns:

  • (String)


25
26
27
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 25

def name
  @name
end

#recommendationString

Recommendations for the detector rule

Returns:

  • (String)


52
53
54
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 52

def recommendation
  @recommendation
end

#risk_levelString

The risk level for the detector rule

Returns:

  • (String)


37
38
39
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 37

def risk_level
  @risk_level
end

#source_detector_rule_idString

ID of source detector rule

Returns:

  • (String)


21
22
23
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 21

def source_detector_rule_id
  @source_detector_rule_id
end

Class Method Details

.attribute_mapObject

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



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 63

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'source_detector_rule_id': :'sourceDetectorRuleId',
    'name': :'name',
    'description': :'description',
    'is_enabled': :'isEnabled',
    'risk_level': :'riskLevel',
    'configurations': :'configurations',
    'condition': :'condition',
    'labels': :'labels',
    'recommendation': :'recommendation',
    'data_source_id': :'dataSourceId',
    'entities_mappings': :'entitiesMappings'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 82

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'source_detector_rule_id': :'String',
    'name': :'String',
    'description': :'String',
    'is_enabled': :'BOOLEAN',
    'risk_level': :'String',
    'configurations': :'Array<OCI::CloudGuard::Models::DetectorConfiguration>',
    'condition': :'OCI::CloudGuard::Models::Condition',
    'labels': :'Array<String>',
    'recommendation': :'String',
    'data_source_id': :'String',
    'entities_mappings': :'Array<OCI::CloudGuard::Models::EntitiesMapping>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 183

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    source_detector_rule_id == other.source_detector_rule_id &&
    name == other.name &&
    description == other.description &&
    is_enabled == other.is_enabled &&
    risk_level == other.risk_level &&
    configurations == other.configurations &&
    condition == other.condition &&
    labels == other.labels &&
    recommendation == other.recommendation &&
    data_source_id == other.data_source_id &&
    entities_mappings == other.entities_mappings
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



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/oci/cloud_guard/models/create_detector_rule_details.rb', line 223

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


203
204
205
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 203

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



212
213
214
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 212

def hash
  [source_detector_rule_id, name, description, is_enabled, risk_level, configurations, condition, labels, recommendation, data_source_id, entities_mappings].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



256
257
258
259
260
261
262
263
264
265
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 256

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



250
251
252
# File 'lib/oci/cloud_guard/models/create_detector_rule_details.rb', line 250

def to_s
  to_hash.to_s
end