Class: OCI::FleetAppsManagement::Models::ComplianceReport

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/fleet_apps_management/models/compliance_report.rb

Overview

Compliance details for a fleet in Fleet Application Management.

Constant Summary collapse

COMPLIANCE_STATE_ENUM =
[
  COMPLIANCE_STATE_UNKNOWN = 'UNKNOWN'.freeze,
  COMPLIANCE_STATE_COMPLIANT = 'COMPLIANT'.freeze,
  COMPLIANCE_STATE_NON_COMPLIANT = 'NON_COMPLIANT'.freeze,
  COMPLIANCE_STATE_WARNING = 'WARNING'.freeze,
  COMPLIANCE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ComplianceReport

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 77

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.id = attributes[:'id'] if attributes[:'id']

  self.fleet_id = attributes[:'fleetId'] if attributes[:'fleetId']

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

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

  self.compliance_state = attributes[:'complianceState'] if attributes[:'complianceState']

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

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

  self.percent_compliant = attributes[:'percentCompliant'] if attributes[:'percentCompliant']

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

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

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

Instance Attribute Details

#compliance_stateString

[Required] The last known compliance state of the fleet.

Returns:

  • (String)


30
31
32
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 30

def compliance_state
  @compliance_state
end

#fleet_idString

[Required] The fleet OCID.

Returns:

  • (String)


26
27
28
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 26

def fleet_id
  @fleet_id
end

#idString

[Required] Compliance Report Identifier

Returns:

  • (String)


22
23
24
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 22

def id
  @id
end

#percent_compliantFloat

The compliance percentage.

Returns:

  • (Float)


34
35
36
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 34

def percent_compliant
  @percent_compliant
end

#resourcesArray<OCI::FleetAppsManagement::Models::ComplianceReportResource>

Resources associated with the Fleet.



38
39
40
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 38

def resources
  @resources
end

Class Method Details

.attribute_mapObject

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



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'fleet_id': :'fleetId',
    'compliance_state': :'complianceState',
    'percent_compliant': :'percentCompliant',
    'resources': :'resources'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 54

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'fleet_id': :'String',
    'compliance_state': :'String',
    'percent_compliant': :'Float',
    'resources': :'Array<OCI::FleetAppsManagement::Models::ComplianceReportResource>'
    # 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



126
127
128
129
130
131
132
133
134
135
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 126

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

  self.class == other.class &&
    id == other.id &&
    fleet_id == other.fleet_id &&
    compliance_state == other.compliance_state &&
    percent_compliant == other.percent_compliant &&
    resources == other.resources
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



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 160

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


140
141
142
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 140

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



149
150
151
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 149

def hash
  [id, fleet_id, compliance_state, percent_compliant, resources].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



193
194
195
196
197
198
199
200
201
202
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 193

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



187
188
189
# File 'lib/oci/fleet_apps_management/models/compliance_report.rb', line 187

def to_s
  to_hash.to_s
end