Class: OCI::AnnouncementsService::Models::BaseService

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

Overview

Object representing a single service. 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

Direct Known Subclasses

NotificationsSummary, Service, ServiceSummary

Constant Summary collapse

PLATFORM_TYPE_ENUM =
[
  PLATFORM_TYPE_IAAS = 'IAAS'.freeze,
  PLATFORM_TYPE_SAAS = 'SAAS'.freeze,
  PLATFORM_TYPE_PAAS = 'PAAS'.freeze,
  PLATFORM_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
COMMS_MANAGER_NAME_ENUM =
[
  COMMS_MANAGER_NAME_CN = 'CN'.freeze,
  COMMS_MANAGER_NAME_FUSION = 'FUSION'.freeze,
  COMMS_MANAGER_NAME_AS = 'AS'.freeze,
  COMMS_MANAGER_NAME_ERF = 'ERF'.freeze,
  COMMS_MANAGER_NAME_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_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 = {}) ⇒ BaseService

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :type (String)

    The value to assign to the #type property

  • :id (String)

    The value to assign to the #id property

  • :service_name (String)

    The value to assign to the #service_name property

  • :short_name (String)

    The value to assign to the #short_name property

  • :team_name (String)

    The value to assign to the #team_name property

  • :platform_type (String)

    The value to assign to the #platform_type property

  • :comms_manager_name (String)

    The value to assign to the #comms_manager_name property

  • :excluded_realms (Array<String>)

    The value to assign to the #excluded_realms property

  • :previous_service_names (Array<String>)

    The value to assign to the #previous_service_names 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

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property



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
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/announcements_service/models/base_service.rb', line 157

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

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

  self.service_name = attributes[:'serviceName'] if attributes[:'serviceName']

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

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

  self.short_name = attributes[:'shortName'] if attributes[:'shortName']

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

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

  self.team_name = attributes[:'teamName'] if attributes[:'teamName']

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

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

  self.platform_type = attributes[:'platformType'] if attributes[:'platformType']

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

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

  self.comms_manager_name = attributes[:'commsManagerName'] if attributes[:'commsManagerName']

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

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

  self.excluded_realms = attributes[:'excludedRealms'] if attributes[:'excludedRealms']

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

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

  self.previous_service_names = attributes[:'previousServiceNames'] if attributes[:'previousServiceNames']

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

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

  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']

  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']
end

Instance Attribute Details

#comms_manager_nameString

[Required] Name of the comms manager team that manages Notifications to this service.

Returns:

  • (String)


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

def comms_manager_name
  @comms_manager_name
end

#excluded_realmsArray<String>

[Required] The list of realms where this service is not available to be used.

Returns:

  • (Array<String>)


64
65
66
# File 'lib/oci/announcements_service/models/base_service.rb', line 64

def excluded_realms
  @excluded_realms
end

#idString

[Required] ID of the service object.

Returns:

  • (String)


40
41
42
# File 'lib/oci/announcements_service/models/base_service.rb', line 40

def id
  @id
end

#lifecycle_stateString

Current state of the service object.

Returns:

  • (String)


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

def lifecycle_state
  @lifecycle_state
end

#platform_typeString

[Required] The platform type this service object is related to.

Returns:

  • (String)


56
57
58
# File 'lib/oci/announcements_service/models/base_service.rb', line 56

def platform_type
  @platform_type
end

#previous_service_namesArray<String>

[Required] The list of previously used names for this service object.

Returns:

  • (Array<String>)


68
69
70
# File 'lib/oci/announcements_service/models/base_service.rb', line 68

def previous_service_names
  @previous_service_names
end

#service_nameString

[Required] Name of the service represented by this object.

Returns:

  • (String)


44
45
46
# File 'lib/oci/announcements_service/models/base_service.rb', line 44

def service_name
  @service_name
end

#short_nameString

[Required] Short name of the team to whom this service object is related.

Returns:

  • (String)


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

def short_name
  @short_name
end

#team_nameString

[Required] Team name to which this service object is related.

Returns:

  • (String)


52
53
54
# File 'lib/oci/announcements_service/models/base_service.rb', line 52

def team_name
  @team_name
end

#time_createdDateTime

The date and time when the service object was created.

Returns:

  • (DateTime)


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

def time_created
  @time_created
end

#time_updatedDateTime

The date and time when the service object was updated.

Returns:

  • (DateTime)


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

def time_updated
  @time_updated
end

#typeString

[Required] The discriminator property.

Returns:

  • (String)


36
37
38
# File 'lib/oci/announcements_service/models/base_service.rb', line 36

def type
  @type
end

Class Method Details

.attribute_mapObject

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



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/oci/announcements_service/models/base_service.rb', line 83

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'id': :'id',
    'service_name': :'serviceName',
    'short_name': :'shortName',
    'team_name': :'teamName',
    'platform_type': :'platformType',
    'comms_manager_name': :'commsManagerName',
    'excluded_realms': :'excludedRealms',
    'previous_service_names': :'previousServiceNames',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'lifecycle_state': :'lifecycleState'
    # 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.



127
128
129
130
131
132
133
134
135
136
# File 'lib/oci/announcements_service/models/base_service.rb', line 127

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

  return 'OCI::AnnouncementsService::Models::Service' if type == 'Service'
  return 'OCI::AnnouncementsService::Models::ServiceSummary' if type == 'ServiceSummary'
  return 'OCI::AnnouncementsService::Models::NotificationsSummary' if type == 'NotificationsSummary'

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

.swagger_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/oci/announcements_service/models/base_service.rb', line 103

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'id': :'String',
    'service_name': :'String',
    'short_name': :'String',
    'team_name': :'String',
    'platform_type': :'String',
    'comms_manager_name': :'String',
    'excluded_realms': :'Array<String>',
    'previous_service_names': :'Array<String>',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'lifecycle_state': :'String'
    # 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



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/oci/announcements_service/models/base_service.rb', line 274

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

  self.class == other.class &&
    type == other.type &&
    id == other.id &&
    service_name == other.service_name &&
    short_name == other.short_name &&
    team_name == other.team_name &&
    platform_type == other.platform_type &&
    comms_manager_name == other.comms_manager_name &&
    excluded_realms == other.excluded_realms &&
    previous_service_names == other.previous_service_names &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    lifecycle_state == other.lifecycle_state
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



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/oci/announcements_service/models/base_service.rb', line 315

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


295
296
297
# File 'lib/oci/announcements_service/models/base_service.rb', line 295

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



304
305
306
# File 'lib/oci/announcements_service/models/base_service.rb', line 304

def hash
  [type, id, service_name, short_name, team_name, platform_type, comms_manager_name, excluded_realms, previous_service_names, time_created, time_updated, lifecycle_state].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



348
349
350
351
352
353
354
355
356
357
# File 'lib/oci/announcements_service/models/base_service.rb', line 348

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



342
343
344
# File 'lib/oci/announcements_service/models/base_service.rb', line 342

def to_s
  to_hash.to_s
end