oci 2.4.5 → 2.4.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,184 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # An announcement status
8
+ #
9
+ class AnnouncementsService::Models::AnnouncementUserStatusDetails # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The OCID of the announcement this status belongs to
11
+ # @return [String]
12
+ attr_accessor :user_status_announcement_id
13
+
14
+ # **[Required]** The OCID of the user this status belongs to
15
+ # @return [String]
16
+ attr_accessor :user_id
17
+
18
+ # The date and time the announcement was acknowledged, in the format defined by RFC3339
19
+ # Example: `2016-07-22T17:43:01.389+0000`
20
+ #
21
+ # @return [DateTime]
22
+ attr_accessor :time_acknowledged
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ # rubocop:disable Style/SymbolLiteral
28
+ 'user_status_announcement_id': :'userStatusAnnouncementId',
29
+ 'user_id': :'userId',
30
+ 'time_acknowledged': :'timeAcknowledged'
31
+ # rubocop:enable Style/SymbolLiteral
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ # rubocop:disable Style/SymbolLiteral
39
+ 'user_status_announcement_id': :'String',
40
+ 'user_id': :'String',
41
+ 'time_acknowledged': :'DateTime'
42
+ # rubocop:enable Style/SymbolLiteral
43
+ }
44
+ end
45
+
46
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
47
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
48
+
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ # @option attributes [String] :user_status_announcement_id The value to assign to the {#user_status_announcement_id} property
53
+ # @option attributes [String] :user_id The value to assign to the {#user_id} property
54
+ # @option attributes [DateTime] :time_acknowledged The value to assign to the {#time_acknowledged} property
55
+ def initialize(attributes = {})
56
+ return unless attributes.is_a?(Hash)
57
+
58
+ # convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
+
61
+ self.user_status_announcement_id = attributes[:'userStatusAnnouncementId'] if attributes[:'userStatusAnnouncementId']
62
+
63
+ raise 'You cannot provide both :userStatusAnnouncementId and :user_status_announcement_id' if attributes.key?(:'userStatusAnnouncementId') && attributes.key?(:'user_status_announcement_id')
64
+
65
+ self.user_status_announcement_id = attributes[:'user_status_announcement_id'] if attributes[:'user_status_announcement_id']
66
+
67
+ self.user_id = attributes[:'userId'] if attributes[:'userId']
68
+
69
+ raise 'You cannot provide both :userId and :user_id' if attributes.key?(:'userId') && attributes.key?(:'user_id')
70
+
71
+ self.user_id = attributes[:'user_id'] if attributes[:'user_id']
72
+
73
+ self.time_acknowledged = attributes[:'timeAcknowledged'] if attributes[:'timeAcknowledged']
74
+
75
+ raise 'You cannot provide both :timeAcknowledged and :time_acknowledged' if attributes.key?(:'timeAcknowledged') && attributes.key?(:'time_acknowledged')
76
+
77
+ self.time_acknowledged = attributes[:'time_acknowledged'] if attributes[:'time_acknowledged']
78
+ end
79
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
80
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
81
+
82
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
83
+
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] other the other object to be compared
87
+ def ==(other)
88
+ return true if equal?(other)
89
+
90
+ self.class == other.class &&
91
+ user_status_announcement_id == other.user_status_announcement_id &&
92
+ user_id == other.user_id &&
93
+ time_acknowledged == other.time_acknowledged
94
+ end
95
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
96
+
97
+ # @see the `==` method
98
+ # @param [Object] other the other object to be compared
99
+ def eql?(other)
100
+ self == other
101
+ end
102
+
103
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
104
+
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Fixnum] Hash code
108
+ def hash
109
+ [user_status_announcement_id, user_id, time_acknowledged].hash
110
+ end
111
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
112
+
113
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
114
+
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+
122
+ self.class.swagger_types.each_pair do |key, type|
123
+ if type =~ /^Array<(.*)>/i
124
+ # check to ensure the input is an array given that the the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ public_method("#{key}=").call(
128
+ attributes[self.class.attribute_map[key]]
129
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
130
+ )
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ public_method("#{key}=").call(
134
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
135
+ )
136
+ end
137
+ # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # Returns the object in the form of hash
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_hash
153
+ hash = {}
154
+ self.class.attribute_map.each_pair do |attr, param|
155
+ value = public_method(attr).call
156
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
157
+
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ private
164
+
165
+ # Outputs non-array value in the form of hash
166
+ # For object, use to_hash. Otherwise, just return the value
167
+ # @param [Object] value Any valid value
168
+ # @return [Hash] Returns the value in the form of hash
169
+ def _to_hash(value)
170
+ if value.is_a?(Array)
171
+ value.compact.map { |v| _to_hash(v) }
172
+ elsif value.is_a?(Hash)
173
+ {}.tap do |hash|
174
+ value.each { |k, v| hash[k] = _to_hash(v) }
175
+ end
176
+ elsif value.respond_to? :to_hash
177
+ value.to_hash
178
+ else
179
+ value
180
+ end
181
+ end
182
+ end
183
+ end
184
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,164 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Results of annoucements search. Contains both announcements, and user specific status of the announcments
8
+ #
9
+ class AnnouncementsService::Models::AnnouncementsCollection # rubocop:disable Metrics/LineLength
10
+ # collection of announcements
11
+ # @return [Array<OCI::AnnouncementsService::Models::AnnouncementSummary>]
12
+ attr_accessor :items
13
+
14
+ # user specific status of found announcements
15
+ # @return [Array<OCI::AnnouncementsService::Models::AnnouncementUserStatusDetails>]
16
+ attr_accessor :user_statuses
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ # rubocop:disable Style/SymbolLiteral
22
+ 'items': :'items',
23
+ 'user_statuses': :'userStatuses'
24
+ # rubocop:enable Style/SymbolLiteral
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ # rubocop:disable Style/SymbolLiteral
32
+ 'items': :'Array<OCI::AnnouncementsService::Models::AnnouncementSummary>',
33
+ 'user_statuses': :'Array<OCI::AnnouncementsService::Models::AnnouncementUserStatusDetails>'
34
+ # rubocop:enable Style/SymbolLiteral
35
+ }
36
+ end
37
+
38
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
39
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
40
+
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ # @option attributes [Array<OCI::AnnouncementsService::Models::AnnouncementSummary>] :items The value to assign to the {#items} property
45
+ # @option attributes [Array<OCI::AnnouncementsService::Models::AnnouncementUserStatusDetails>] :user_statuses The value to assign to the {#user_statuses} property
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ self.items = attributes[:'items'] if attributes[:'items']
53
+
54
+ self.user_statuses = attributes[:'userStatuses'] if attributes[:'userStatuses']
55
+
56
+ raise 'You cannot provide both :userStatuses and :user_statuses' if attributes.key?(:'userStatuses') && attributes.key?(:'user_statuses')
57
+
58
+ self.user_statuses = attributes[:'user_statuses'] if attributes[:'user_statuses']
59
+ end
60
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
61
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
62
+
63
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
64
+
65
+
66
+ # Checks equality by comparing each attribute.
67
+ # @param [Object] other the other object to be compared
68
+ def ==(other)
69
+ return true if equal?(other)
70
+
71
+ self.class == other.class &&
72
+ items == other.items &&
73
+ user_statuses == other.user_statuses
74
+ end
75
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
76
+
77
+ # @see the `==` method
78
+ # @param [Object] other the other object to be compared
79
+ def eql?(other)
80
+ self == other
81
+ end
82
+
83
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
84
+
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [items, user_statuses].hash
90
+ end
91
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
92
+
93
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
94
+
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /^Array<(.*)>/i
104
+ # check to ensure the input is an array given that the the attribute
105
+ # is documented as an array but the input is not
106
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
107
+ public_method("#{key}=").call(
108
+ attributes[self.class.attribute_map[key]]
109
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
110
+ )
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ public_method("#{key}=").call(
114
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
115
+ )
116
+ end
117
+ # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
123
+
124
+ # Returns the string representation of the object
125
+ # @return [String] String presentation of the object
126
+ def to_s
127
+ to_hash.to_s
128
+ end
129
+
130
+ # Returns the object in the form of hash
131
+ # @return [Hash] Returns the object in the form of hash
132
+ def to_hash
133
+ hash = {}
134
+ self.class.attribute_map.each_pair do |attr, param|
135
+ value = public_method(attr).call
136
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
137
+
138
+ hash[param] = _to_hash(value)
139
+ end
140
+ hash
141
+ end
142
+
143
+ private
144
+
145
+ # Outputs non-array value in the form of hash
146
+ # For object, use to_hash. Otherwise, just return the value
147
+ # @param [Object] value Any valid value
148
+ # @return [Hash] Returns the value in the form of hash
149
+ def _to_hash(value)
150
+ if value.is_a?(Array)
151
+ value.compact.map { |v| _to_hash(v) }
152
+ elsif value.is_a?(Hash)
153
+ {}.tap do |hash|
154
+ value.each { |k, v| hash[k] = _to_hash(v) }
155
+ end
156
+ elsif value.respond_to? :to_hash
157
+ value.to_hash
158
+ else
159
+ value
160
+ end
161
+ end
162
+ end
163
+ end
164
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,396 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Base for announcements and incidents
8
+ # 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
9
+ class AnnouncementsService::Models::BaseAnnouncement # rubocop:disable Metrics/LineLength
10
+ ANNOUNCEMENT_TYPE_ENUM = [
11
+ ANNOUNCEMENT_TYPE_ACTION_RECOMMENDED = 'ACTION_RECOMMENDED'.freeze,
12
+ ANNOUNCEMENT_TYPE_ACTION_REQUIRED = 'ACTION_REQUIRED'.freeze,
13
+ ANNOUNCEMENT_TYPE_EMERGENCY_CHANGE = 'EMERGENCY_CHANGE'.freeze,
14
+ ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE = 'EMERGENCY_MAINTENANCE'.freeze,
15
+ ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_COMPLETE = 'EMERGENCY_MAINTENANCE_COMPLETE'.freeze,
16
+ ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_EXTENDED = 'EMERGENCY_MAINTENANCE_EXTENDED'.freeze,
17
+ ANNOUNCEMENT_TYPE_EMERGENCY_MAINTENANCE_RESCHEDULED = 'EMERGENCY_MAINTENANCE_RESCHEDULED'.freeze,
18
+ ANNOUNCEMENT_TYPE_INFORMATION = 'INFORMATION'.freeze,
19
+ ANNOUNCEMENT_TYPE_PLANNED_CHANGE = 'PLANNED_CHANGE'.freeze,
20
+ ANNOUNCEMENT_TYPE_PLANNED_CHANGE_COMPLETE = 'PLANNED_CHANGE_COMPLETE'.freeze,
21
+ ANNOUNCEMENT_TYPE_PLANNED_CHANGE_EXTENDED = 'PLANNED_CHANGE_EXTENDED'.freeze,
22
+ ANNOUNCEMENT_TYPE_PLANNED_CHANGE_RESCHEDULED = 'PLANNED_CHANGE_RESCHEDULED'.freeze,
23
+ ANNOUNCEMENT_TYPE_PRODUCTION_EVENT_NOTIFICATION = 'PRODUCTION_EVENT_NOTIFICATION'.freeze,
24
+ ANNOUNCEMENT_TYPE_SCHEDULED_MAINTENANCE = 'SCHEDULED_MAINTENANCE'.freeze
25
+ ].freeze
26
+
27
+ LIFECYCLE_STATE_ENUM = [
28
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
29
+ LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze
30
+ ].freeze
31
+
32
+ # **[Required]** The OCID of the announcement
33
+ # @return [String]
34
+ attr_accessor :id
35
+
36
+ # **[Required]** Entity type
37
+ # @return [String]
38
+ attr_accessor :type
39
+
40
+ # **[Required]** The reference JIRA ticket number
41
+ # @return [String]
42
+ attr_accessor :reference_ticket_number
43
+
44
+ # **[Required]** Forms part of the email subject and/or the console representation (a banner or alike)
45
+ # @return [String]
46
+ attr_accessor :summary
47
+
48
+ # The title of the first time value, e.g. Time Started
49
+ # @return [String]
50
+ attr_accessor :time_one_title
51
+
52
+ # The first time value, actual meaning depending on notification type
53
+ # @return [DateTime]
54
+ attr_accessor :time_one_value
55
+
56
+ # The title of the second time value, e.g. Time Ended
57
+ # @return [String]
58
+ attr_accessor :time_two_title
59
+
60
+ # The second time value, actual meaning depending on notification type
61
+ # @return [DateTime]
62
+ attr_accessor :time_two_value
63
+
64
+ # Impacted services
65
+ # @return [Array<String>]
66
+ attr_accessor :services
67
+
68
+ # Impacted regions
69
+ # @return [Array<String>]
70
+ attr_accessor :affected_regions
71
+
72
+ # **[Required]** The detailed description of an announcement
73
+ # @return [String]
74
+ attr_reader :announcement_type
75
+
76
+ # **[Required]** Lifecycle states of announcement
77
+ # @return [String]
78
+ attr_reader :lifecycle_state
79
+
80
+ # **[Required]** Show announcement as a banner
81
+ # @return [BOOLEAN]
82
+ attr_accessor :is_banner
83
+
84
+ # The date and time the announcement was created, in the format defined by RFC3339
85
+ # Example: `2016-07-22T17:43:01.389+0000`
86
+ #
87
+ # @return [DateTime]
88
+ attr_accessor :time_created
89
+
90
+ # The date and time the announcement was last updated, in the format defined by RFC3339
91
+ # Example: `2016-07-22T17:43:01.389+0000`
92
+ #
93
+ # @return [DateTime]
94
+ attr_accessor :time_updated
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ # rubocop:disable Style/SymbolLiteral
100
+ 'id': :'id',
101
+ 'type': :'type',
102
+ 'reference_ticket_number': :'referenceTicketNumber',
103
+ 'summary': :'summary',
104
+ 'time_one_title': :'timeOneTitle',
105
+ 'time_one_value': :'timeOneValue',
106
+ 'time_two_title': :'timeTwoTitle',
107
+ 'time_two_value': :'timeTwoValue',
108
+ 'services': :'services',
109
+ 'affected_regions': :'affectedRegions',
110
+ 'announcement_type': :'announcementType',
111
+ 'lifecycle_state': :'lifecycleState',
112
+ 'is_banner': :'isBanner',
113
+ 'time_created': :'timeCreated',
114
+ 'time_updated': :'timeUpdated'
115
+ # rubocop:enable Style/SymbolLiteral
116
+ }
117
+ end
118
+
119
+ # Attribute type mapping.
120
+ def self.swagger_types
121
+ {
122
+ # rubocop:disable Style/SymbolLiteral
123
+ 'id': :'String',
124
+ 'type': :'String',
125
+ 'reference_ticket_number': :'String',
126
+ 'summary': :'String',
127
+ 'time_one_title': :'String',
128
+ 'time_one_value': :'DateTime',
129
+ 'time_two_title': :'String',
130
+ 'time_two_value': :'DateTime',
131
+ 'services': :'Array<String>',
132
+ 'affected_regions': :'Array<String>',
133
+ 'announcement_type': :'String',
134
+ 'lifecycle_state': :'String',
135
+ 'is_banner': :'BOOLEAN',
136
+ 'time_created': :'DateTime',
137
+ 'time_updated': :'DateTime'
138
+ # rubocop:enable Style/SymbolLiteral
139
+ }
140
+ end
141
+
142
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
143
+
144
+
145
+ # Given the hash representation of a subtype of this class,
146
+ # use the info in the hash to return the class of the subtype.
147
+ def self.get_subtype(object_hash)
148
+ type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral
149
+
150
+ return 'OCI::AnnouncementsService::Models::AnnouncementSummary' if type == 'AnnouncementSummary'
151
+ return 'OCI::AnnouncementsService::Models::Announcement' if type == 'Announcement'
152
+
153
+ # TODO: Log a warning when the subtype is not found.
154
+ 'OCI::AnnouncementsService::Models::BaseAnnouncement'
155
+ end
156
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
157
+
158
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
159
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
160
+
161
+
162
+ # Initializes the object
163
+ # @param [Hash] attributes Model attributes in the form of hash
164
+ # @option attributes [String] :id The value to assign to the {#id} property
165
+ # @option attributes [String] :type The value to assign to the {#type} property
166
+ # @option attributes [String] :reference_ticket_number The value to assign to the {#reference_ticket_number} property
167
+ # @option attributes [String] :summary The value to assign to the {#summary} property
168
+ # @option attributes [String] :time_one_title The value to assign to the {#time_one_title} property
169
+ # @option attributes [DateTime] :time_one_value The value to assign to the {#time_one_value} property
170
+ # @option attributes [String] :time_two_title The value to assign to the {#time_two_title} property
171
+ # @option attributes [DateTime] :time_two_value The value to assign to the {#time_two_value} property
172
+ # @option attributes [Array<String>] :services The value to assign to the {#services} property
173
+ # @option attributes [Array<String>] :affected_regions The value to assign to the {#affected_regions} property
174
+ # @option attributes [String] :announcement_type The value to assign to the {#announcement_type} property
175
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
176
+ # @option attributes [BOOLEAN] :is_banner The value to assign to the {#is_banner} property
177
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
178
+ # @option attributes [DateTime] :time_updated The value to assign to the {#time_updated} property
179
+ def initialize(attributes = {})
180
+ return unless attributes.is_a?(Hash)
181
+
182
+ # convert string to symbol for hash key
183
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
184
+
185
+ self.id = attributes[:'id'] if attributes[:'id']
186
+
187
+ self.type = attributes[:'type'] if attributes[:'type']
188
+
189
+ self.reference_ticket_number = attributes[:'referenceTicketNumber'] if attributes[:'referenceTicketNumber']
190
+
191
+ raise 'You cannot provide both :referenceTicketNumber and :reference_ticket_number' if attributes.key?(:'referenceTicketNumber') && attributes.key?(:'reference_ticket_number')
192
+
193
+ self.reference_ticket_number = attributes[:'reference_ticket_number'] if attributes[:'reference_ticket_number']
194
+
195
+ self.summary = attributes[:'summary'] if attributes[:'summary']
196
+
197
+ self.time_one_title = attributes[:'timeOneTitle'] if attributes[:'timeOneTitle']
198
+
199
+ raise 'You cannot provide both :timeOneTitle and :time_one_title' if attributes.key?(:'timeOneTitle') && attributes.key?(:'time_one_title')
200
+
201
+ self.time_one_title = attributes[:'time_one_title'] if attributes[:'time_one_title']
202
+
203
+ self.time_one_value = attributes[:'timeOneValue'] if attributes[:'timeOneValue']
204
+
205
+ raise 'You cannot provide both :timeOneValue and :time_one_value' if attributes.key?(:'timeOneValue') && attributes.key?(:'time_one_value')
206
+
207
+ self.time_one_value = attributes[:'time_one_value'] if attributes[:'time_one_value']
208
+
209
+ self.time_two_title = attributes[:'timeTwoTitle'] if attributes[:'timeTwoTitle']
210
+
211
+ raise 'You cannot provide both :timeTwoTitle and :time_two_title' if attributes.key?(:'timeTwoTitle') && attributes.key?(:'time_two_title')
212
+
213
+ self.time_two_title = attributes[:'time_two_title'] if attributes[:'time_two_title']
214
+
215
+ self.time_two_value = attributes[:'timeTwoValue'] if attributes[:'timeTwoValue']
216
+
217
+ raise 'You cannot provide both :timeTwoValue and :time_two_value' if attributes.key?(:'timeTwoValue') && attributes.key?(:'time_two_value')
218
+
219
+ self.time_two_value = attributes[:'time_two_value'] if attributes[:'time_two_value']
220
+
221
+ self.services = attributes[:'services'] if attributes[:'services']
222
+
223
+ self.affected_regions = attributes[:'affectedRegions'] if attributes[:'affectedRegions']
224
+
225
+ raise 'You cannot provide both :affectedRegions and :affected_regions' if attributes.key?(:'affectedRegions') && attributes.key?(:'affected_regions')
226
+
227
+ self.affected_regions = attributes[:'affected_regions'] if attributes[:'affected_regions']
228
+
229
+ self.announcement_type = attributes[:'announcementType'] if attributes[:'announcementType']
230
+
231
+ raise 'You cannot provide both :announcementType and :announcement_type' if attributes.key?(:'announcementType') && attributes.key?(:'announcement_type')
232
+
233
+ self.announcement_type = attributes[:'announcement_type'] if attributes[:'announcement_type']
234
+
235
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
236
+
237
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
238
+
239
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
240
+
241
+ self.is_banner = attributes[:'isBanner'] unless attributes[:'isBanner'].nil?
242
+
243
+ raise 'You cannot provide both :isBanner and :is_banner' if attributes.key?(:'isBanner') && attributes.key?(:'is_banner')
244
+
245
+ self.is_banner = attributes[:'is_banner'] unless attributes[:'is_banner'].nil?
246
+
247
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
248
+
249
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
250
+
251
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
252
+
253
+ self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']
254
+
255
+ raise 'You cannot provide both :timeUpdated and :time_updated' if attributes.key?(:'timeUpdated') && attributes.key?(:'time_updated')
256
+
257
+ self.time_updated = attributes[:'time_updated'] if attributes[:'time_updated']
258
+ end
259
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
260
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
261
+
262
+ # Custom attribute writer method checking allowed values (enum).
263
+ # @param [Object] announcement_type Object to be assigned
264
+ def announcement_type=(announcement_type)
265
+ # rubocop: disable Metrics/LineLength
266
+ raise "Invalid value for 'announcement_type': this must be one of the values in ANNOUNCEMENT_TYPE_ENUM." if announcement_type && !ANNOUNCEMENT_TYPE_ENUM.include?(announcement_type)
267
+
268
+ # rubocop: enable Metrics/LineLength
269
+ @announcement_type = announcement_type
270
+ end
271
+
272
+ # Custom attribute writer method checking allowed values (enum).
273
+ # @param [Object] lifecycle_state Object to be assigned
274
+ def lifecycle_state=(lifecycle_state)
275
+ # rubocop: disable Metrics/LineLength
276
+ raise "Invalid value for 'lifecycle_state': this must be one of the values in LIFECYCLE_STATE_ENUM." if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
277
+
278
+ # rubocop: enable Metrics/LineLength
279
+ @lifecycle_state = lifecycle_state
280
+ end
281
+
282
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
283
+
284
+
285
+ # Checks equality by comparing each attribute.
286
+ # @param [Object] other the other object to be compared
287
+ def ==(other)
288
+ return true if equal?(other)
289
+
290
+ self.class == other.class &&
291
+ id == other.id &&
292
+ type == other.type &&
293
+ reference_ticket_number == other.reference_ticket_number &&
294
+ summary == other.summary &&
295
+ time_one_title == other.time_one_title &&
296
+ time_one_value == other.time_one_value &&
297
+ time_two_title == other.time_two_title &&
298
+ time_two_value == other.time_two_value &&
299
+ services == other.services &&
300
+ affected_regions == other.affected_regions &&
301
+ announcement_type == other.announcement_type &&
302
+ lifecycle_state == other.lifecycle_state &&
303
+ is_banner == other.is_banner &&
304
+ time_created == other.time_created &&
305
+ time_updated == other.time_updated
306
+ end
307
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
308
+
309
+ # @see the `==` method
310
+ # @param [Object] other the other object to be compared
311
+ def eql?(other)
312
+ self == other
313
+ end
314
+
315
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
316
+
317
+
318
+ # Calculates hash code according to all attributes.
319
+ # @return [Fixnum] Hash code
320
+ def hash
321
+ [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
322
+ end
323
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
324
+
325
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
326
+
327
+
328
+ # Builds the object from hash
329
+ # @param [Hash] attributes Model attributes in the form of hash
330
+ # @return [Object] Returns the model itself
331
+ def build_from_hash(attributes)
332
+ return nil unless attributes.is_a?(Hash)
333
+
334
+ self.class.swagger_types.each_pair do |key, type|
335
+ if type =~ /^Array<(.*)>/i
336
+ # check to ensure the input is an array given that the the attribute
337
+ # is documented as an array but the input is not
338
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
339
+ public_method("#{key}=").call(
340
+ attributes[self.class.attribute_map[key]]
341
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
342
+ )
343
+ end
344
+ elsif !attributes[self.class.attribute_map[key]].nil?
345
+ public_method("#{key}=").call(
346
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
347
+ )
348
+ end
349
+ # or else data not found in attributes(hash), not an issue as the data can be optional
350
+ end
351
+
352
+ self
353
+ end
354
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
355
+
356
+ # Returns the string representation of the object
357
+ # @return [String] String presentation of the object
358
+ def to_s
359
+ to_hash.to_s
360
+ end
361
+
362
+ # Returns the object in the form of hash
363
+ # @return [Hash] Returns the object in the form of hash
364
+ def to_hash
365
+ hash = {}
366
+ self.class.attribute_map.each_pair do |attr, param|
367
+ value = public_method(attr).call
368
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
369
+
370
+ hash[param] = _to_hash(value)
371
+ end
372
+ hash
373
+ end
374
+
375
+ private
376
+
377
+ # Outputs non-array value in the form of hash
378
+ # For object, use to_hash. Otherwise, just return the value
379
+ # @param [Object] value Any valid value
380
+ # @return [Hash] Returns the value in the form of hash
381
+ def _to_hash(value)
382
+ if value.is_a?(Array)
383
+ value.compact.map { |v| _to_hash(v) }
384
+ elsif value.is_a?(Hash)
385
+ {}.tap do |hash|
386
+ value.each { |k, v| hash[k] = _to_hash(v) }
387
+ end
388
+ elsif value.respond_to? :to_hash
389
+ value.to_hash
390
+ else
391
+ value
392
+ end
393
+ end
394
+ end
395
+ end
396
+ # rubocop:enable Lint/UnneededCopDisableDirective