Class: OCI::CloudGuard::Models::ResourceRiskScoreAggregation
- Inherits:
-
Object
- Object
- OCI::CloudGuard::Models::ResourceRiskScoreAggregation
- Defined in:
- lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb
Overview
Risk score of a resource.
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, RISK_LEVEL_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#risk_level ⇒ String
[Required] The risk level.
-
#risk_score ⇒ Float
[Required] The risk score.
-
#score_timestamp ⇒ Float
[Required] The date and time for which the score is calculated.
-
#tactics ⇒ Array<String>
[Required] List of tactics used for evaluating the risk score.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ResourceRiskScoreAggregation
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ ResourceRiskScoreAggregation
Initializes the object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 71 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.tactics = attributes[:'tactics'] if attributes[:'tactics'] self. = attributes[:'scoreTimestamp'] if attributes[:'scoreTimestamp'] raise 'You cannot provide both :scoreTimestamp and :score_timestamp' if attributes.key?(:'scoreTimestamp') && attributes.key?(:'score_timestamp') self. = attributes[:'score_timestamp'] if attributes[:'score_timestamp'] self.risk_score = attributes[:'riskScore'] if attributes[:'riskScore'] raise 'You cannot provide both :riskScore and :risk_score' if attributes.key?(:'riskScore') && attributes.key?(:'risk_score') self.risk_score = attributes[:'risk_score'] if attributes[:'risk_score'] 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'] end |
Instance Attribute Details
#risk_level ⇒ String
[Required] The risk level
35 36 37 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 35 def risk_level @risk_level end |
#risk_score ⇒ Float
[Required] The risk score
31 32 33 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 31 def risk_score @risk_score end |
#score_timestamp ⇒ Float
[Required] The date and time for which the score is calculated. Format defined by RFC3339.
27 28 29 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 27 def @score_timestamp end |
#tactics ⇒ Array<String>
[Required] List of tactics used for evaluating the risk score
23 24 25 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 23 def tactics @tactics end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 38 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'tactics': :'tactics', 'score_timestamp': :'scoreTimestamp', 'risk_score': :'riskScore', 'risk_level': :'riskLevel' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 50 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'tactics': :'Array<String>', 'score_timestamp': :'Float', 'risk_score': :'Float', 'risk_level': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
118 119 120 121 122 123 124 125 126 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 118 def ==(other) return true if equal?(other) self.class == other.class && tactics == other.tactics && == other. && risk_score == other.risk_score && risk_level == other.risk_level end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 151 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
131 132 133 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 131 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
140 141 142 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 140 def hash [tactics, , risk_score, risk_level].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
184 185 186 187 188 189 190 191 192 193 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 184 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_s ⇒ String
Returns the string representation of the object
178 179 180 |
# File 'lib/oci/cloud_guard/models/resource_risk_score_aggregation.rb', line 178 def to_s to_hash.to_s end |