oci 2.4.5 → 2.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/oci.rb +1 -0
- data/lib/oci/announcements_service/announcement_client.rb +368 -0
- data/lib/oci/announcements_service/announcement_client_composite_operations.rb +24 -0
- data/lib/oci/announcements_service/announcements_service.rb +25 -0
- data/lib/oci/announcements_service/models/affected_resource.rb +178 -0
- data/lib/oci/announcements_service/models/announcement.rb +252 -0
- data/lib/oci/announcements_service/models/announcement_summary.rb +202 -0
- data/lib/oci/announcements_service/models/announcement_user_status_details.rb +184 -0
- data/lib/oci/announcements_service/models/announcements_collection.rb +164 -0
- data/lib/oci/announcements_service/models/base_announcement.rb +396 -0
- data/lib/oci/announcements_service/models/notification_followup_details.rb +163 -0
- data/lib/oci/announcements_service/util.rb +2 -0
- data/lib/oci/regions.rb +1 -0
- data/lib/oci/version.rb +1 -1
- metadata +13 -2
@@ -0,0 +1,178 @@
|
|
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
|
+
# Descrption of a resource affected by the announcement
|
8
|
+
#
|
9
|
+
class AnnouncementsService::Models::AffectedResource # rubocop:disable Metrics/LineLength
|
10
|
+
# **[Required]** The OCID of the resource
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :resource_id
|
13
|
+
|
14
|
+
# **[Required]** User-friendly name of the resource
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :resource_name
|
17
|
+
|
18
|
+
# **[Required]** Region where this resource belongs to
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :region
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
# rubocop:disable Style/SymbolLiteral
|
26
|
+
'resource_id': :'resourceId',
|
27
|
+
'resource_name': :'resourceName',
|
28
|
+
'region': :'region'
|
29
|
+
# rubocop:enable Style/SymbolLiteral
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
# rubocop:disable Style/SymbolLiteral
|
37
|
+
'resource_id': :'String',
|
38
|
+
'resource_name': :'String',
|
39
|
+
'region': :'String'
|
40
|
+
# rubocop:enable Style/SymbolLiteral
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
45
|
+
# rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
46
|
+
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
# @option attributes [String] :resource_id The value to assign to the {#resource_id} property
|
51
|
+
# @option attributes [String] :resource_name The value to assign to the {#resource_name} property
|
52
|
+
# @option attributes [String] :region The value to assign to the {#region} property
|
53
|
+
def initialize(attributes = {})
|
54
|
+
return unless attributes.is_a?(Hash)
|
55
|
+
|
56
|
+
# convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
58
|
+
|
59
|
+
self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']
|
60
|
+
|
61
|
+
raise 'You cannot provide both :resourceId and :resource_id' if attributes.key?(:'resourceId') && attributes.key?(:'resource_id')
|
62
|
+
|
63
|
+
self.resource_id = attributes[:'resource_id'] if attributes[:'resource_id']
|
64
|
+
|
65
|
+
self.resource_name = attributes[:'resourceName'] if attributes[:'resourceName']
|
66
|
+
|
67
|
+
raise 'You cannot provide both :resourceName and :resource_name' if attributes.key?(:'resourceName') && attributes.key?(:'resource_name')
|
68
|
+
|
69
|
+
self.resource_name = attributes[:'resource_name'] if attributes[:'resource_name']
|
70
|
+
|
71
|
+
self.region = attributes[:'region'] if attributes[:'region']
|
72
|
+
end
|
73
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
74
|
+
# rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
75
|
+
|
76
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
77
|
+
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] other the other object to be compared
|
81
|
+
def ==(other)
|
82
|
+
return true if equal?(other)
|
83
|
+
|
84
|
+
self.class == other.class &&
|
85
|
+
resource_id == other.resource_id &&
|
86
|
+
resource_name == other.resource_name &&
|
87
|
+
region == other.region
|
88
|
+
end
|
89
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] other the other object to be compared
|
93
|
+
def eql?(other)
|
94
|
+
self == other
|
95
|
+
end
|
96
|
+
|
97
|
+
# rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
98
|
+
|
99
|
+
|
100
|
+
# Calculates hash code according to all attributes.
|
101
|
+
# @return [Fixnum] Hash code
|
102
|
+
def hash
|
103
|
+
[resource_id, resource_name, region].hash
|
104
|
+
end
|
105
|
+
# rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
106
|
+
|
107
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
108
|
+
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
|
116
|
+
self.class.swagger_types.each_pair do |key, type|
|
117
|
+
if type =~ /^Array<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
121
|
+
public_method("#{key}=").call(
|
122
|
+
attributes[self.class.attribute_map[key]]
|
123
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
124
|
+
)
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
public_method("#{key}=").call(
|
128
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
129
|
+
)
|
130
|
+
end
|
131
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
132
|
+
end
|
133
|
+
|
134
|
+
self
|
135
|
+
end
|
136
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
137
|
+
|
138
|
+
# Returns the string representation of the object
|
139
|
+
# @return [String] String presentation of the object
|
140
|
+
def to_s
|
141
|
+
to_hash.to_s
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the object in the form of hash
|
145
|
+
# @return [Hash] Returns the object in the form of hash
|
146
|
+
def to_hash
|
147
|
+
hash = {}
|
148
|
+
self.class.attribute_map.each_pair do |attr, param|
|
149
|
+
value = public_method(attr).call
|
150
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
151
|
+
|
152
|
+
hash[param] = _to_hash(value)
|
153
|
+
end
|
154
|
+
hash
|
155
|
+
end
|
156
|
+
|
157
|
+
private
|
158
|
+
|
159
|
+
# Outputs non-array value in the form of hash
|
160
|
+
# For object, use to_hash. Otherwise, just return the value
|
161
|
+
# @param [Object] value Any valid value
|
162
|
+
# @return [Hash] Returns the value in the form of hash
|
163
|
+
def _to_hash(value)
|
164
|
+
if value.is_a?(Array)
|
165
|
+
value.compact.map { |v| _to_hash(v) }
|
166
|
+
elsif value.is_a?(Hash)
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
169
|
+
end
|
170
|
+
elsif value.respond_to? :to_hash
|
171
|
+
value.to_hash
|
172
|
+
else
|
173
|
+
value
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
# rubocop:enable Lint/UnneededCopDisableDirective
|
@@ -0,0 +1,252 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'logger'
|
5
|
+
require_relative 'base_announcement'
|
6
|
+
|
7
|
+
# rubocop:disable Lint/UnneededCopDisableDirective
|
8
|
+
module OCI
|
9
|
+
# An announcement object which represents a message targetted to a specific tenant
|
10
|
+
#
|
11
|
+
class AnnouncementsService::Models::Announcement < AnnouncementsService::Models::BaseAnnouncement # rubocop:disable Metrics/LineLength
|
12
|
+
# A more detailed explanation of the notification. A markdown format input
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :description
|
15
|
+
|
16
|
+
# A markdown format input that forms e.g. the FAQ section of a notification
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :additional_information
|
19
|
+
|
20
|
+
# @return [Array<OCI::AnnouncementsService::Models::NotificationFollowupDetails>]
|
21
|
+
attr_accessor :followups
|
22
|
+
|
23
|
+
# List of resources (possibly empty) affected by this announcement
|
24
|
+
# @return [Array<OCI::AnnouncementsService::Models::AffectedResource>]
|
25
|
+
attr_accessor :affected_resources
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
# rubocop:disable Style/SymbolLiteral
|
31
|
+
'id': :'id',
|
32
|
+
'type': :'type',
|
33
|
+
'reference_ticket_number': :'referenceTicketNumber',
|
34
|
+
'summary': :'summary',
|
35
|
+
'time_one_title': :'timeOneTitle',
|
36
|
+
'time_one_value': :'timeOneValue',
|
37
|
+
'time_two_title': :'timeTwoTitle',
|
38
|
+
'time_two_value': :'timeTwoValue',
|
39
|
+
'services': :'services',
|
40
|
+
'affected_regions': :'affectedRegions',
|
41
|
+
'announcement_type': :'announcementType',
|
42
|
+
'lifecycle_state': :'lifecycleState',
|
43
|
+
'is_banner': :'isBanner',
|
44
|
+
'time_created': :'timeCreated',
|
45
|
+
'time_updated': :'timeUpdated',
|
46
|
+
'description': :'description',
|
47
|
+
'additional_information': :'additionalInformation',
|
48
|
+
'followups': :'followups',
|
49
|
+
'affected_resources': :'affectedResources'
|
50
|
+
# rubocop:enable Style/SymbolLiteral
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.swagger_types
|
56
|
+
{
|
57
|
+
# rubocop:disable Style/SymbolLiteral
|
58
|
+
'id': :'String',
|
59
|
+
'type': :'String',
|
60
|
+
'reference_ticket_number': :'String',
|
61
|
+
'summary': :'String',
|
62
|
+
'time_one_title': :'String',
|
63
|
+
'time_one_value': :'DateTime',
|
64
|
+
'time_two_title': :'String',
|
65
|
+
'time_two_value': :'DateTime',
|
66
|
+
'services': :'Array<String>',
|
67
|
+
'affected_regions': :'Array<String>',
|
68
|
+
'announcement_type': :'String',
|
69
|
+
'lifecycle_state': :'String',
|
70
|
+
'is_banner': :'BOOLEAN',
|
71
|
+
'time_created': :'DateTime',
|
72
|
+
'time_updated': :'DateTime',
|
73
|
+
'description': :'String',
|
74
|
+
'additional_information': :'String',
|
75
|
+
'followups': :'Array<OCI::AnnouncementsService::Models::NotificationFollowupDetails>',
|
76
|
+
'affected_resources': :'Array<OCI::AnnouncementsService::Models::AffectedResource>'
|
77
|
+
# rubocop:enable Style/SymbolLiteral
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
82
|
+
# rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
83
|
+
|
84
|
+
|
85
|
+
# Initializes the object
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
# @option attributes [String] :id The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#id #id} proprety
|
88
|
+
# @option attributes [String] :reference_ticket_number The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#reference_ticket_number #reference_ticket_number} proprety
|
89
|
+
# @option attributes [String] :summary The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#summary #summary} proprety
|
90
|
+
# @option attributes [String] :time_one_title The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_one_title #time_one_title} proprety
|
91
|
+
# @option attributes [DateTime] :time_one_value The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_one_value #time_one_value} proprety
|
92
|
+
# @option attributes [String] :time_two_title The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_two_title #time_two_title} proprety
|
93
|
+
# @option attributes [DateTime] :time_two_value The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_two_value #time_two_value} proprety
|
94
|
+
# @option attributes [Array<String>] :services The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#services #services} proprety
|
95
|
+
# @option attributes [Array<String>] :affected_regions The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#affected_regions #affected_regions} proprety
|
96
|
+
# @option attributes [String] :announcement_type The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#announcement_type #announcement_type} proprety
|
97
|
+
# @option attributes [String] :lifecycle_state The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#lifecycle_state #lifecycle_state} proprety
|
98
|
+
# @option attributes [BOOLEAN] :is_banner The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#is_banner #is_banner} proprety
|
99
|
+
# @option attributes [DateTime] :time_created The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_created #time_created} proprety
|
100
|
+
# @option attributes [DateTime] :time_updated The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_updated #time_updated} proprety
|
101
|
+
# @option attributes [String] :description The value to assign to the {#description} property
|
102
|
+
# @option attributes [String] :additional_information The value to assign to the {#additional_information} property
|
103
|
+
# @option attributes [Array<OCI::AnnouncementsService::Models::NotificationFollowupDetails>] :followups The value to assign to the {#followups} property
|
104
|
+
# @option attributes [Array<OCI::AnnouncementsService::Models::AffectedResource>] :affected_resources The value to assign to the {#affected_resources} property
|
105
|
+
def initialize(attributes = {})
|
106
|
+
return unless attributes.is_a?(Hash)
|
107
|
+
|
108
|
+
attributes['type'] = 'Announcement'
|
109
|
+
|
110
|
+
super(attributes)
|
111
|
+
|
112
|
+
# convert string to symbol for hash key
|
113
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
114
|
+
|
115
|
+
self.description = attributes[:'description'] if attributes[:'description']
|
116
|
+
|
117
|
+
self.additional_information = attributes[:'additionalInformation'] if attributes[:'additionalInformation']
|
118
|
+
|
119
|
+
raise 'You cannot provide both :additionalInformation and :additional_information' if attributes.key?(:'additionalInformation') && attributes.key?(:'additional_information')
|
120
|
+
|
121
|
+
self.additional_information = attributes[:'additional_information'] if attributes[:'additional_information']
|
122
|
+
|
123
|
+
self.followups = attributes[:'followups'] if attributes[:'followups']
|
124
|
+
|
125
|
+
self.affected_resources = attributes[:'affectedResources'] if attributes[:'affectedResources']
|
126
|
+
|
127
|
+
raise 'You cannot provide both :affectedResources and :affected_resources' if attributes.key?(:'affectedResources') && attributes.key?(:'affected_resources')
|
128
|
+
|
129
|
+
self.affected_resources = attributes[:'affected_resources'] if attributes[:'affected_resources']
|
130
|
+
end
|
131
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
132
|
+
# rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
133
|
+
|
134
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
135
|
+
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] other the other object to be compared
|
139
|
+
def ==(other)
|
140
|
+
return true if equal?(other)
|
141
|
+
|
142
|
+
self.class == other.class &&
|
143
|
+
id == other.id &&
|
144
|
+
type == other.type &&
|
145
|
+
reference_ticket_number == other.reference_ticket_number &&
|
146
|
+
summary == other.summary &&
|
147
|
+
time_one_title == other.time_one_title &&
|
148
|
+
time_one_value == other.time_one_value &&
|
149
|
+
time_two_title == other.time_two_title &&
|
150
|
+
time_two_value == other.time_two_value &&
|
151
|
+
services == other.services &&
|
152
|
+
affected_regions == other.affected_regions &&
|
153
|
+
announcement_type == other.announcement_type &&
|
154
|
+
lifecycle_state == other.lifecycle_state &&
|
155
|
+
is_banner == other.is_banner &&
|
156
|
+
time_created == other.time_created &&
|
157
|
+
time_updated == other.time_updated &&
|
158
|
+
description == other.description &&
|
159
|
+
additional_information == other.additional_information &&
|
160
|
+
followups == other.followups &&
|
161
|
+
affected_resources == other.affected_resources
|
162
|
+
end
|
163
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
164
|
+
|
165
|
+
# @see the `==` method
|
166
|
+
# @param [Object] other the other object to be compared
|
167
|
+
def eql?(other)
|
168
|
+
self == other
|
169
|
+
end
|
170
|
+
|
171
|
+
# rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
172
|
+
|
173
|
+
|
174
|
+
# Calculates hash code according to all attributes.
|
175
|
+
# @return [Fixnum] Hash code
|
176
|
+
def hash
|
177
|
+
[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, description, additional_information, followups, affected_resources].hash
|
178
|
+
end
|
179
|
+
# rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
180
|
+
|
181
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
182
|
+
|
183
|
+
|
184
|
+
# Builds the object from hash
|
185
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
186
|
+
# @return [Object] Returns the model itself
|
187
|
+
def build_from_hash(attributes)
|
188
|
+
return nil unless attributes.is_a?(Hash)
|
189
|
+
|
190
|
+
self.class.swagger_types.each_pair do |key, type|
|
191
|
+
if type =~ /^Array<(.*)>/i
|
192
|
+
# check to ensure the input is an array given that the the attribute
|
193
|
+
# is documented as an array but the input is not
|
194
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
195
|
+
public_method("#{key}=").call(
|
196
|
+
attributes[self.class.attribute_map[key]]
|
197
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
198
|
+
)
|
199
|
+
end
|
200
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
201
|
+
public_method("#{key}=").call(
|
202
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
203
|
+
)
|
204
|
+
end
|
205
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
206
|
+
end
|
207
|
+
|
208
|
+
self
|
209
|
+
end
|
210
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
211
|
+
|
212
|
+
# Returns the string representation of the object
|
213
|
+
# @return [String] String presentation of the object
|
214
|
+
def to_s
|
215
|
+
to_hash.to_s
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = public_method(attr).call
|
224
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
225
|
+
|
226
|
+
hash[param] = _to_hash(value)
|
227
|
+
end
|
228
|
+
hash
|
229
|
+
end
|
230
|
+
|
231
|
+
private
|
232
|
+
|
233
|
+
# Outputs non-array value in the form of hash
|
234
|
+
# For object, use to_hash. Otherwise, just return the value
|
235
|
+
# @param [Object] value Any valid value
|
236
|
+
# @return [Hash] Returns the value in the form of hash
|
237
|
+
def _to_hash(value)
|
238
|
+
if value.is_a?(Array)
|
239
|
+
value.compact.map { |v| _to_hash(v) }
|
240
|
+
elsif value.is_a?(Hash)
|
241
|
+
{}.tap do |hash|
|
242
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
243
|
+
end
|
244
|
+
elsif value.respond_to? :to_hash
|
245
|
+
value.to_hash
|
246
|
+
else
|
247
|
+
value
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
# rubocop:enable Lint/UnneededCopDisableDirective
|
@@ -0,0 +1,202 @@
|
|
1
|
+
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
require 'logger'
|
5
|
+
require_relative 'base_announcement'
|
6
|
+
|
7
|
+
# rubocop:disable Lint/UnneededCopDisableDirective
|
8
|
+
module OCI
|
9
|
+
# An announcement summary object which is returned by List API
|
10
|
+
#
|
11
|
+
class AnnouncementsService::Models::AnnouncementSummary < AnnouncementsService::Models::BaseAnnouncement # rubocop:disable Metrics/LineLength
|
12
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
13
|
+
def self.attribute_map
|
14
|
+
{
|
15
|
+
# rubocop:disable Style/SymbolLiteral
|
16
|
+
'id': :'id',
|
17
|
+
'type': :'type',
|
18
|
+
'reference_ticket_number': :'referenceTicketNumber',
|
19
|
+
'summary': :'summary',
|
20
|
+
'time_one_title': :'timeOneTitle',
|
21
|
+
'time_one_value': :'timeOneValue',
|
22
|
+
'time_two_title': :'timeTwoTitle',
|
23
|
+
'time_two_value': :'timeTwoValue',
|
24
|
+
'services': :'services',
|
25
|
+
'affected_regions': :'affectedRegions',
|
26
|
+
'announcement_type': :'announcementType',
|
27
|
+
'lifecycle_state': :'lifecycleState',
|
28
|
+
'is_banner': :'isBanner',
|
29
|
+
'time_created': :'timeCreated',
|
30
|
+
'time_updated': :'timeUpdated'
|
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
|
+
'id': :'String',
|
40
|
+
'type': :'String',
|
41
|
+
'reference_ticket_number': :'String',
|
42
|
+
'summary': :'String',
|
43
|
+
'time_one_title': :'String',
|
44
|
+
'time_one_value': :'DateTime',
|
45
|
+
'time_two_title': :'String',
|
46
|
+
'time_two_value': :'DateTime',
|
47
|
+
'services': :'Array<String>',
|
48
|
+
'affected_regions': :'Array<String>',
|
49
|
+
'announcement_type': :'String',
|
50
|
+
'lifecycle_state': :'String',
|
51
|
+
'is_banner': :'BOOLEAN',
|
52
|
+
'time_created': :'DateTime',
|
53
|
+
'time_updated': :'DateTime'
|
54
|
+
# rubocop:enable Style/SymbolLiteral
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
59
|
+
# rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
60
|
+
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
# @option attributes [String] :id The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#id #id} proprety
|
65
|
+
# @option attributes [String] :reference_ticket_number The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#reference_ticket_number #reference_ticket_number} proprety
|
66
|
+
# @option attributes [String] :summary The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#summary #summary} proprety
|
67
|
+
# @option attributes [String] :time_one_title The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_one_title #time_one_title} proprety
|
68
|
+
# @option attributes [DateTime] :time_one_value The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_one_value #time_one_value} proprety
|
69
|
+
# @option attributes [String] :time_two_title The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_two_title #time_two_title} proprety
|
70
|
+
# @option attributes [DateTime] :time_two_value The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_two_value #time_two_value} proprety
|
71
|
+
# @option attributes [Array<String>] :services The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#services #services} proprety
|
72
|
+
# @option attributes [Array<String>] :affected_regions The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#affected_regions #affected_regions} proprety
|
73
|
+
# @option attributes [String] :announcement_type The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#announcement_type #announcement_type} proprety
|
74
|
+
# @option attributes [String] :lifecycle_state The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#lifecycle_state #lifecycle_state} proprety
|
75
|
+
# @option attributes [BOOLEAN] :is_banner The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#is_banner #is_banner} proprety
|
76
|
+
# @option attributes [DateTime] :time_created The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_created #time_created} proprety
|
77
|
+
# @option attributes [DateTime] :time_updated The value to assign to the {OCI::AnnouncementsService::Models::BaseAnnouncement#time_updated #time_updated} proprety
|
78
|
+
def initialize(attributes = {})
|
79
|
+
return unless attributes.is_a?(Hash)
|
80
|
+
|
81
|
+
attributes['type'] = 'AnnouncementSummary'
|
82
|
+
|
83
|
+
super(attributes)
|
84
|
+
end
|
85
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
86
|
+
# rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
87
|
+
|
88
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
89
|
+
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] other the other object to be compared
|
93
|
+
def ==(other)
|
94
|
+
return true if equal?(other)
|
95
|
+
|
96
|
+
self.class == other.class &&
|
97
|
+
id == other.id &&
|
98
|
+
type == other.type &&
|
99
|
+
reference_ticket_number == other.reference_ticket_number &&
|
100
|
+
summary == other.summary &&
|
101
|
+
time_one_title == other.time_one_title &&
|
102
|
+
time_one_value == other.time_one_value &&
|
103
|
+
time_two_title == other.time_two_title &&
|
104
|
+
time_two_value == other.time_two_value &&
|
105
|
+
services == other.services &&
|
106
|
+
affected_regions == other.affected_regions &&
|
107
|
+
announcement_type == other.announcement_type &&
|
108
|
+
lifecycle_state == other.lifecycle_state &&
|
109
|
+
is_banner == other.is_banner &&
|
110
|
+
time_created == other.time_created &&
|
111
|
+
time_updated == other.time_updated
|
112
|
+
end
|
113
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
114
|
+
|
115
|
+
# @see the `==` method
|
116
|
+
# @param [Object] other the other object to be compared
|
117
|
+
def eql?(other)
|
118
|
+
self == other
|
119
|
+
end
|
120
|
+
|
121
|
+
# rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
122
|
+
|
123
|
+
|
124
|
+
# Calculates hash code according to all attributes.
|
125
|
+
# @return [Fixnum] Hash code
|
126
|
+
def hash
|
127
|
+
[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
|
128
|
+
end
|
129
|
+
# rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
130
|
+
|
131
|
+
# rubocop:disable Metrics/AbcSize, Layout/EmptyLines
|
132
|
+
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def build_from_hash(attributes)
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
139
|
+
|
140
|
+
self.class.swagger_types.each_pair do |key, type|
|
141
|
+
if type =~ /^Array<(.*)>/i
|
142
|
+
# check to ensure the input is an array given that the the attribute
|
143
|
+
# is documented as an array but the input is not
|
144
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
145
|
+
public_method("#{key}=").call(
|
146
|
+
attributes[self.class.attribute_map[key]]
|
147
|
+
.map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
|
148
|
+
)
|
149
|
+
end
|
150
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
151
|
+
public_method("#{key}=").call(
|
152
|
+
OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
|
153
|
+
)
|
154
|
+
end
|
155
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
156
|
+
end
|
157
|
+
|
158
|
+
self
|
159
|
+
end
|
160
|
+
# rubocop:enable Metrics/AbcSize, Layout/EmptyLines
|
161
|
+
|
162
|
+
# Returns the string representation of the object
|
163
|
+
# @return [String] String presentation of the object
|
164
|
+
def to_s
|
165
|
+
to_hash.to_s
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the object in the form of hash
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
170
|
+
def to_hash
|
171
|
+
hash = {}
|
172
|
+
self.class.attribute_map.each_pair do |attr, param|
|
173
|
+
value = public_method(attr).call
|
174
|
+
next if value.nil? && !instance_variable_defined?("@#{attr}")
|
175
|
+
|
176
|
+
hash[param] = _to_hash(value)
|
177
|
+
end
|
178
|
+
hash
|
179
|
+
end
|
180
|
+
|
181
|
+
private
|
182
|
+
|
183
|
+
# Outputs non-array value in the form of hash
|
184
|
+
# For object, use to_hash. Otherwise, just return the value
|
185
|
+
# @param [Object] value Any valid value
|
186
|
+
# @return [Hash] Returns the value in the form of hash
|
187
|
+
def _to_hash(value)
|
188
|
+
if value.is_a?(Array)
|
189
|
+
value.compact.map { |v| _to_hash(v) }
|
190
|
+
elsif value.is_a?(Hash)
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
193
|
+
end
|
194
|
+
elsif value.respond_to? :to_hash
|
195
|
+
value.to_hash
|
196
|
+
else
|
197
|
+
value
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
# rubocop:enable Lint/UnneededCopDisableDirective
|