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):



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
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
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 116

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#on_job_canceledBOOLEAN

Enables or disables notification on job canceled.

Returns:

  • (BOOLEAN)


52
53
54
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 52

def on_job_canceled
  @on_job_canceled
end

#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_job_schedule_changeBOOLEAN

Enables or disables notification on job schedule change.

Returns:

  • (BOOLEAN)


56
57
58
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 56

def on_job_schedule_change
  @on_job_schedule_change
end

#on_job_startBOOLEAN

Enables or disables notification on job start.

Returns:

  • (BOOLEAN)


48
49
50
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 48

def on_job_start
  @on_job_start
end

#on_job_successBOOLEAN

Enables or disables notification on job success.

Returns:

  • (BOOLEAN)


44
45
46
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 44

def on_job_success
  @on_job_success
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.



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

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',
    'on_job_success': :'onJobSuccess',
    'on_job_start': :'onJobStart',
    'on_job_canceled': :'onJobCanceled',
    'on_job_schedule_change': :'onJobScheduleChange'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 79

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',
    'on_job_success': :'BOOLEAN',
    'on_job_start': :'BOOLEAN',
    'on_job_canceled': :'BOOLEAN',
    'on_job_schedule_change': :'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



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 224

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 &&
    on_job_success == other.on_job_success &&
    on_job_start == other.on_job_start &&
    on_job_canceled == other.on_job_canceled &&
    on_job_schedule_change == other.on_job_schedule_change
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



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 265

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


245
246
247
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 245

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



254
255
256
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 254

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, on_job_success, on_job_start, on_job_canceled, on_job_schedule_change].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



298
299
300
301
302
303
304
305
306
307
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 298

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



292
293
294
# File 'lib/oci/fleet_apps_management/models/preferences.rb', line 292

def to_s
  to_hash.to_s
end