Class: OCI::AnnouncementsService::Models::BaseAnnouncement

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/announcements_service/models/base_announcement.rb

Overview

Incident information that forms the basis of an announcement. Avoid entering confidential information. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

ANNOUNCEMENT_TYPE_ENUM =
[
  ANNOUNCEMENT_TYPE_ACTION_RECOMMENDED = 'ACTION_RECOMMENDED'.freeze,
  ANNOUNCEMENT_TYPE_ACTION_REQUIRED = 'ACTION_REQUIRED'.freeze,
  ANNOUNCEMENT_TYPE_EMERGENCY_CHANGE = 'EMERGENCY_CHANGE'.freeze,
  ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE = 'EMERGENCY_MAINTENANCE'.freeze,
  ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_COMPLETE = 'EMERGENCY_MAINTENANCE_COMPLETE'.freeze,
  ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_EXTENDED = 'EMERGENCY_MAINTENANCE_EXTENDED'.freeze,
  ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_RESCHEDULED = 'EMERGENCY_MAINTENANCE_RESCHEDULED'.freeze,
  ANNOUNCEMENT_TYPE_INFORMATION = 'INFORMATION'.freeze,
  ANNOUNCEMENT_TYPE_PLANNED_CHANGE = 'PLANNED_CHANGE'.freeze,
  ANNOUNCEMENT_TYPE_PLANNED_CHANGE_COMPLETE = 'PLANNED_CHANGE_COMPLETE'.freeze,
  ANNOUNCEMENT_TYPE_PLANNED_CHANGE_EXTENDED = 'PLANNED_CHANGE_EXTENDED'.freeze,
  ANNOUNCEMENT_TYPE_PLANNED_CHANGE_RESCHEDULED = 'PLANNED_CHANGE_RESCHEDULED'.freeze,
  ANNOUNCEMENT_TYPE_PRODUCTION_EVENT_NOTIFICATION = 'PRODUCTION_EVENT_NOTIFICATION'.freeze,
  ANNOUNCEMENT_TYPE_SCHEDULED_MAINTENANCE = 'SCHEDULED_MAINTENANCE'.freeze
].freeze
LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BaseAnnouncement

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

  • :type (String)

    The value to assign to the #type property

  • :reference_ticket_number (String)

    The value to assign to the #reference_ticket_number property

  • :summary (String)

    The value to assign to the #summary property

  • :time_one_title (String)

    The value to assign to the #time_one_title property

  • :time_one_value (DateTime)

    The value to assign to the #time_one_value property

  • :time_two_title (String)

    The value to assign to the #time_two_title property

  • :time_two_value (DateTime)

    The value to assign to the #time_two_value property

  • :services (Array<String>)

    The value to assign to the #services property

  • :affected_regions (Array<String>)

    The value to assign to the #affected_regions property

  • :announcement_type (String)

    The value to assign to the #announcement_type property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property

  • :is_banner (BOOLEAN)

    The value to assign to the #is_banner property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :time_updated (DateTime)

    The value to assign to the #time_updated property



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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 189

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

  self.reference_ticket_number = attributes[:'referenceTicketNumber'] if attributes[:'referenceTicketNumber']

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

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

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

  self.time_one_title = attributes[:'timeOneTitle'] if attributes[:'timeOneTitle']

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

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

  self.time_one_value = attributes[:'timeOneValue'] if attributes[:'timeOneValue']

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

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

  self.time_two_title = attributes[:'timeTwoTitle'] if attributes[:'timeTwoTitle']

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

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

  self.time_two_value = attributes[:'timeTwoValue'] if attributes[:'timeTwoValue']

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

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

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

  self.affected_regions = attributes[:'affectedRegions'] if attributes[:'affectedRegions']

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

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

  self.announcement_type = attributes[:'announcementType'] if attributes[:'announcementType']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

  self.is_banner = attributes[:'isBanner'] unless attributes[:'isBanner'].nil?

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

  self.is_banner = attributes[:'is_banner'] unless attributes[:'is_banner'].nil?

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

Instance Attribute Details

#affected_regionsArray<String>

[Required] Impacted regions.

Returns:

  • (Array<String>)


80
81
82
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 80

def affected_regions
  @affected_regions
end

#announcement_typeString

[Required] The type of announcement. An announcement’s type signals its severity.

Returns:

  • (String)


84
85
86
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 84

def announcement_type
  @announcement_type
end

#idString

[Required] The OCID of the announcement.

Returns:

  • (String)


34
35
36
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 34

def id
  @id
end

#is_bannerBOOLEAN

[Required] Whether the announcement is displayed as a banner in the console.

Returns:

  • (BOOLEAN)


92
93
94
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 92

def is_banner
  @is_banner
end

#lifecycle_stateString

[Required] The current lifecycle state of the announcement.

Returns:

  • (String)


88
89
90
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 88

def lifecycle_state
  @lifecycle_state
end

#reference_ticket_numberString

[Required] The reference Jira ticket number.

Returns:

  • (String)


42
43
44
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 42

def reference_ticket_number
  @reference_ticket_number
end

#servicesArray<String>

[Required] Impacted Oracle Cloud Infrastructure services.

Returns:

  • (Array<String>)


76
77
78
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 76

def services
  @services
end

#summaryString

[Required] A summary of the issue. A summary might appear in the console banner view of the announcement or in an email subject line. Avoid entering confidential information.

Returns:

  • (String)


48
49
50
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 48

def summary
  @summary
end

#time_createdDateTime

The date and time the announcement was created, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format. Example: ‘2019-01-01T17:43:01.389+0000`

Returns:

  • (DateTime)


98
99
100
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 98

def time_created
  @time_created
end

#time_one_titleString

The label associated with an initial time value. Example: ‘Time Started`

Returns:

  • (String)


54
55
56
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 54

def time_one_title
  @time_one_title
end

#time_one_valueDateTime

The actual value of the first time value for the event. Typically, this is the time an event started, but the meaning can vary, depending on the announcement type.

Returns:

  • (DateTime)


60
61
62
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 60

def time_one_value
  @time_one_value
end

#time_two_titleString

The label associated with a second time value. Example: ‘Time Ended`

Returns:

  • (String)


66
67
68
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 66

def time_two_title
  @time_two_title
end

#time_two_valueDateTime

The actual value of the second time value. Typically, this is the time an event ended, but the meaning can vary, depending on the announcement type.

Returns:

  • (DateTime)


72
73
74
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 72

def time_two_value
  @time_two_value
end

#time_updatedDateTime

The date and time the announcement was last updated, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format. Example: ‘2019-01-01T17:43:01.389+0000`

Returns:

  • (DateTime)


104
105
106
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 104

def time_updated
  @time_updated
end

#typeString

[Required] The entity type.

Returns:

  • (String)


38
39
40
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 38

def type
  @type
end

Class Method Details

.attribute_mapObject

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



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 107

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'type': :'type',
    'reference_ticket_number': :'referenceTicketNumber',
    'summary': :'summary',
    'time_one_title': :'timeOneTitle',
    'time_one_value': :'timeOneValue',
    'time_two_title': :'timeTwoTitle',
    'time_two_value': :'timeTwoValue',
    'services': :'services',
    'affected_regions': :'affectedRegions',
    'announcement_type': :'announcementType',
    'lifecycle_state': :'lifecycleState',
    'is_banner': :'isBanner',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



157
158
159
160
161
162
163
164
165
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 157

def self.get_subtype(object_hash)
  type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::AnnouncementsService::Models::AnnouncementSummary' if type == 'AnnouncementSummary'
  return 'OCI::AnnouncementsService::Models::Announcement' if type == 'Announcement'

  # TODO: Log a warning when the subtype is not found.
  'OCI::AnnouncementsService::Models::BaseAnnouncement'
end

.swagger_typesObject

Attribute type mapping.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 130

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'type': :'String',
    'reference_ticket_number': :'String',
    'summary': :'String',
    'time_one_title': :'String',
    'time_one_value': :'DateTime',
    'time_two_title': :'String',
    'time_two_value': :'DateTime',
    'services': :'Array<String>',
    'affected_regions': :'Array<String>',
    'announcement_type': :'String',
    'lifecycle_state': :'String',
    'is_banner': :'BOOLEAN',
    'time_created': :'DateTime',
    'time_updated': :'DateTime'
    # 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



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 293

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

  self.class == other.class &&
    id == other.id &&
    type == other.type &&
    reference_ticket_number == other.reference_ticket_number &&
    summary == other.summary &&
    time_one_title == other.time_one_title &&
    time_one_value == other.time_one_value &&
    time_two_title == other.time_two_title &&
    time_two_value == other.time_two_value &&
    services == other.services &&
    affected_regions == other.affected_regions &&
    announcement_type == other.announcement_type &&
    lifecycle_state == other.lifecycle_state &&
    is_banner == other.is_banner &&
    time_created == other.time_created &&
    time_updated == other.time_updated
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



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 337

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


317
318
319
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 317

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



326
327
328
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 326

def hash
  [id, type, reference_ticket_number, summary, time_one_title, time_one_value, time_two_title, time_two_value, services, affected_regions, announcement_type, lifecycle_state, is_banner, time_created, time_updated].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



370
371
372
373
374
375
376
377
378
379
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 370

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



364
365
366
# File 'lib/oci/announcements_service/models/base_announcement.rb', line 364

def to_s
  to_hash.to_s
end