Class: OCI::FleetAppsManagement::Models::Preferences

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

Overview

Preferences to send notifications on the fleet activities.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Preferences

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 88

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#on_job_failureBOOLEAN

Enables or disables notification on Job Failures.

Returns:

  • (BOOLEAN)


16
17
18
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 16

def on_job_failure
  @on_job_failure
end

#on_resource_non_complianceBOOLEAN

Enables or disables notification when fleet resource becomes non compliant.

Returns:

  • (BOOLEAN)


36
37
38
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 36

def on_resource_non_compliance
  @on_resource_non_compliance
end

#on_runbook_newer_versionBOOLEAN

Enables or disables notification when a newer version of runbook associated with a fleet is available

Returns:

  • (BOOLEAN)


40
41
42
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 40

def on_runbook_newer_version
  @on_runbook_newer_version
end

#on_task_failureBOOLEAN

Enables or disables notification on task failure.

Returns:

  • (BOOLEAN)


28
29
30
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 28

def on_task_failure
  @on_task_failure
end

#on_task_pauseBOOLEAN

Enables or disables notification when a task is paused.

Returns:

  • (BOOLEAN)


24
25
26
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 24

def on_task_pause
  @on_task_pause
end

#on_task_successBOOLEAN

Enables or disables notification on task success.

Returns:

  • (BOOLEAN)


32
33
34
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 32

def on_task_success
  @on_task_success
end

#on_topology_modificationBOOLEAN

Enables or disables notification on Environment Fleet Topology Modification.

Returns:

  • (BOOLEAN)


20
21
22
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 20

def on_topology_modification
  @on_topology_modification
end

#upcoming_scheduleOCI::FleetAppsManagement::Models::UpcomingSchedule



12
13
14
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 12

def upcoming_schedule
  @upcoming_schedule
end

Class Method Details

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 43

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'upcoming_schedule': :'upcomingSchedule',
    'on_job_failure': :'onJobFailure',
    'on_topology_modification': :'onTopologyModification',
    'on_task_pause': :'onTaskPause',
    'on_task_failure': :'onTaskFailure',
    'on_task_success': :'onTaskSuccess',
    'on_resource_non_compliance': :'onResourceNonCompliance',
    'on_runbook_newer_version': :'onRunbookNewerVersion'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 59

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'upcoming_schedule': :'OCI::FleetAppsManagement::Models::UpcomingSchedule',
    'on_job_failure': :'BOOLEAN',
    'on_topology_modification': :'BOOLEAN',
    'on_task_pause': :'BOOLEAN',
    'on_task_failure': :'BOOLEAN',
    'on_task_success': :'BOOLEAN',
    'on_resource_non_compliance': :'BOOLEAN',
    'on_runbook_newer_version': :'BOOLEAN'
    # 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



164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 164

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

  self.class == other.class &&
    upcoming_schedule == other.upcoming_schedule &&
    on_job_failure == other.on_job_failure &&
    on_topology_modification == other.on_topology_modification &&
    on_task_pause == other.on_task_pause &&
    on_task_failure == other.on_task_failure &&
    on_task_success == other.on_task_success &&
    on_resource_non_compliance == other.on_resource_non_compliance &&
    on_runbook_newer_version == other.on_runbook_newer_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



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 201

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


181
182
183
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 181

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



190
191
192
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 190

def hash
  [upcoming_schedule, on_job_failure, on_topology_modification, on_task_pause, on_task_failure, on_task_success, on_resource_non_compliance, on_runbook_newer_version].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 234

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



228
229
230
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 228

def to_s
  to_hash.to_s
end