incident_io_api 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/incident_io/api/alert_grouping_preferences_v3_api.rb +367 -0
- data/lib/incident_io/api/alert_rules_v3_api.rb +367 -0
- data/lib/incident_io/api/catalog_v3_api.rb +68 -0
- data/lib/incident_io/api/team_grouping_preferences_v3_api.rb +364 -0
- data/lib/incident_io/models/alert_grouping_conditional_branch_v3.rb +204 -0
- data/lib/incident_io/models/alert_grouping_default_branch_v3.rb +165 -0
- data/lib/incident_io/models/alert_grouping_preference_v3.rb +368 -0
- data/lib/incident_io/models/alert_grouping_preferences_create_payload_v3.rb +225 -0
- data/lib/incident_io/models/alert_grouping_preferences_create_result_v3.rb +164 -0
- data/lib/incident_io/models/alert_grouping_preferences_list_result_v3.rb +192 -0
- data/lib/incident_io/models/alert_grouping_preferences_show_result_v3.rb +164 -0
- data/lib/incident_io/models/alert_grouping_preferences_update_payload_v3.rb +198 -0
- data/lib/incident_io/models/alert_grouping_preferences_update_result_v3.rb +164 -0
- data/lib/incident_io/models/alert_grouping_settings_v3.rb +246 -0
- data/lib/incident_io/models/alert_rule_action_v3.rb +240 -0
- data/lib/incident_io/models/alert_rule_block_v3.rb +222 -0
- data/lib/incident_io/models/alert_rule_branch_v3.rb +254 -0
- data/lib/incident_io/models/alert_rule_create_incident_action_v3.rb +177 -0
- data/lib/incident_io/models/alert_rule_escalate_action_v3.rb +215 -0
- data/lib/incident_io/models/alert_rule_nested_branch_v3.rb +242 -0
- data/lib/incident_io/models/alert_rule_post_action_v3.rb +202 -0
- data/lib/incident_io/models/alert_rule_set_v3.rb +351 -0
- data/lib/incident_io/models/alert_rules_create_payload_v3.rb +225 -0
- data/lib/incident_io/models/alert_rules_create_result_v3.rb +164 -0
- data/lib/incident_io/models/alert_rules_list_result_v3.rb +192 -0
- data/lib/incident_io/models/alert_rules_show_result_v3.rb +164 -0
- data/lib/incident_io/models/alert_rules_update_payload_v3.rb +198 -0
- data/lib/incident_io/models/alert_rules_update_result_v3.rb +164 -0
- data/lib/incident_io/models/catalog_bulk_archive_entries_payload_v3.rb +212 -0
- data/lib/incident_io/models/team_grouping_preference_v3.rb +300 -0
- data/lib/incident_io/models/team_grouping_preferences_create_payload_v3.rb +191 -0
- data/lib/incident_io/models/team_grouping_preferences_create_result_v3.rb +164 -0
- data/lib/incident_io/models/team_grouping_preferences_list_result_v3.rb +192 -0
- data/lib/incident_io/models/team_grouping_preferences_show_result_v3.rb +164 -0
- data/lib/incident_io/models/team_grouping_preferences_update_payload_v3.rb +191 -0
- data/lib/incident_io/models/team_grouping_preferences_update_result_v3.rb +164 -0
- data/lib/incident_io/version.rb +1 -1
- data/lib/incident_io.rb +35 -0
- metadata +37 -2
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#incident.io
|
|
3
|
+
|
|
4
|
+
#Ruby client for the incident.io API.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module IncidentIo
|
|
17
|
+
# How alerts are grouped together
|
|
18
|
+
class AlertGroupingSettingsV3 < ApiModelBase
|
|
19
|
+
# Use AI to group similar looking alerts. AI alert grouping can only group alerts that are attributed to the same team, so grouping keys must be empty or only contain the team alert attribute. Private alerts are not grouped unless AI incident access allows private incidents and alerts. Omit it on an update to keep the current value.
|
|
20
|
+
attr_accessor :ai_enabled
|
|
21
|
+
|
|
22
|
+
# Optional instructions the model follows when AI groups these alerts, such as how the systems you run relate to each other. Up to 2000 characters.
|
|
23
|
+
attr_accessor :ai_instructions
|
|
24
|
+
|
|
25
|
+
# Whether these alerts are grouped. When false, none of them are grouped.
|
|
26
|
+
attr_accessor :enabled
|
|
27
|
+
|
|
28
|
+
# Which alert attributes these alerts are grouped by. Only set when grouping is enabled.
|
|
29
|
+
attr_accessor :grouping_keys
|
|
30
|
+
|
|
31
|
+
# How long the grouping window is, in seconds. Must be between 60 (1 minute) and 172800 (48 hours). Only set when grouping is enabled.
|
|
32
|
+
attr_accessor :window_seconds
|
|
33
|
+
|
|
34
|
+
# How the grouping window behaves. 'rolling' keeps the window open for window_seconds after the most recent alert, so the group stays open as long as alerts keep arriving. 'fixed' opens the window when the first alert arrives and always closes window_seconds later. Only set when grouping is enabled. Known values: `rolling`, `fixed`
|
|
35
|
+
attr_accessor :window_type
|
|
36
|
+
|
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
38
|
+
def self.attribute_map
|
|
39
|
+
{
|
|
40
|
+
:'ai_enabled' => :'ai_enabled',
|
|
41
|
+
:'ai_instructions' => :'ai_instructions',
|
|
42
|
+
:'enabled' => :'enabled',
|
|
43
|
+
:'grouping_keys' => :'grouping_keys',
|
|
44
|
+
:'window_seconds' => :'window_seconds',
|
|
45
|
+
:'window_type' => :'window_type'
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Returns attribute mapping this model knows about
|
|
50
|
+
def self.acceptable_attribute_map
|
|
51
|
+
attribute_map
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Returns all the JSON keys this model knows about
|
|
55
|
+
def self.acceptable_attributes
|
|
56
|
+
acceptable_attribute_map.values
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Attribute type mapping.
|
|
60
|
+
def self.openapi_types
|
|
61
|
+
{
|
|
62
|
+
:'ai_enabled' => :'Boolean',
|
|
63
|
+
:'ai_instructions' => :'String',
|
|
64
|
+
:'enabled' => :'Boolean',
|
|
65
|
+
:'grouping_keys' => :'Array<GroupingKeyV3>',
|
|
66
|
+
:'window_seconds' => :'Integer',
|
|
67
|
+
:'window_type' => :'String'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# List of attributes with nullable: true
|
|
72
|
+
def self.openapi_nullable
|
|
73
|
+
Set.new([
|
|
74
|
+
])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Initializes the object
|
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
79
|
+
def initialize(attributes = {})
|
|
80
|
+
if (!attributes.is_a?(Hash))
|
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IncidentIo::AlertGroupingSettingsV3` initialize method"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
85
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
87
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IncidentIo::AlertGroupingSettingsV3`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
89
|
+
end
|
|
90
|
+
h[k.to_sym] = v
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'ai_enabled')
|
|
94
|
+
self.ai_enabled = attributes[:'ai_enabled']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'ai_instructions')
|
|
98
|
+
self.ai_instructions = attributes[:'ai_instructions']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'enabled')
|
|
102
|
+
self.enabled = attributes[:'enabled']
|
|
103
|
+
else
|
|
104
|
+
self.enabled = nil
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'grouping_keys')
|
|
108
|
+
if (value = attributes[:'grouping_keys']).is_a?(Array)
|
|
109
|
+
self.grouping_keys = value
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'window_seconds')
|
|
114
|
+
self.window_seconds = attributes[:'window_seconds']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'window_type')
|
|
118
|
+
self.window_type = attributes[:'window_type']
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
123
|
+
# @return Array for valid properties with the reasons
|
|
124
|
+
def list_invalid_properties
|
|
125
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
126
|
+
invalid_properties = Array.new
|
|
127
|
+
if @enabled.nil?
|
|
128
|
+
invalid_properties.push('invalid value for "enabled", enabled cannot be nil.')
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if !@window_seconds.nil? && @window_seconds > 172800
|
|
132
|
+
invalid_properties.push('invalid value for "window_seconds", must be smaller than or equal to 172800.')
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if !@window_seconds.nil? && @window_seconds < 60
|
|
136
|
+
invalid_properties.push('invalid value for "window_seconds", must be greater than or equal to 60.')
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
invalid_properties
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Check to see if the all the properties in the model are valid
|
|
143
|
+
# @return true if the model is valid
|
|
144
|
+
def valid?
|
|
145
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
146
|
+
return false if @enabled.nil?
|
|
147
|
+
return false if !@window_seconds.nil? && @window_seconds > 172800
|
|
148
|
+
return false if !@window_seconds.nil? && @window_seconds < 60
|
|
149
|
+
true
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Custom attribute writer method with validation
|
|
153
|
+
# @param [Object] enabled Value to be assigned
|
|
154
|
+
def enabled=(enabled)
|
|
155
|
+
if enabled.nil?
|
|
156
|
+
fail ArgumentError, 'enabled cannot be nil'
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
@enabled = enabled
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Custom attribute writer method with validation
|
|
163
|
+
# @param [Object] window_seconds Value to be assigned
|
|
164
|
+
def window_seconds=(window_seconds)
|
|
165
|
+
if window_seconds.nil?
|
|
166
|
+
fail ArgumentError, 'window_seconds cannot be nil'
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if window_seconds > 172800
|
|
170
|
+
fail ArgumentError, 'invalid value for "window_seconds", must be smaller than or equal to 172800.'
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if window_seconds < 60
|
|
174
|
+
fail ArgumentError, 'invalid value for "window_seconds", must be greater than or equal to 60.'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
@window_seconds = window_seconds
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Checks equality by comparing each attribute.
|
|
181
|
+
# @param [Object] Object to be compared
|
|
182
|
+
def ==(o)
|
|
183
|
+
return true if self.equal?(o)
|
|
184
|
+
self.class == o.class &&
|
|
185
|
+
ai_enabled == o.ai_enabled &&
|
|
186
|
+
ai_instructions == o.ai_instructions &&
|
|
187
|
+
enabled == o.enabled &&
|
|
188
|
+
grouping_keys == o.grouping_keys &&
|
|
189
|
+
window_seconds == o.window_seconds &&
|
|
190
|
+
window_type == o.window_type
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# @see the `==` method
|
|
194
|
+
# @param [Object] Object to be compared
|
|
195
|
+
def eql?(o)
|
|
196
|
+
self == o
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Calculates hash code according to all attributes.
|
|
200
|
+
# @return [Integer] Hash code
|
|
201
|
+
def hash
|
|
202
|
+
[ai_enabled, ai_instructions, enabled, grouping_keys, window_seconds, window_type].hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Builds the object from hash
|
|
206
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
207
|
+
# @return [Object] Returns the model itself
|
|
208
|
+
def self.build_from_hash(attributes)
|
|
209
|
+
return nil unless attributes.is_a?(Hash)
|
|
210
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
211
|
+
transformed_hash = {}
|
|
212
|
+
openapi_types.each_pair do |key, type|
|
|
213
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
214
|
+
transformed_hash["#{key}"] = nil
|
|
215
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
216
|
+
# check to ensure the input is an array given that the attribute
|
|
217
|
+
# is documented as an array but the input is not
|
|
218
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
219
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
220
|
+
end
|
|
221
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
222
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
new(transformed_hash)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
# Returns the object in the form of hash
|
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
|
230
|
+
def to_hash
|
|
231
|
+
hash = {}
|
|
232
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
233
|
+
value = self.send(attr)
|
|
234
|
+
if value.nil?
|
|
235
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
236
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
hash[param] = _to_hash(value)
|
|
240
|
+
end
|
|
241
|
+
hash
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
end
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#incident.io
|
|
3
|
+
|
|
4
|
+
#Ruby client for the incident.io API.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module IncidentIo
|
|
17
|
+
# One action a branch takes. Set type, and the object of the same name with the action's parameters. An investigate action has no parameters.
|
|
18
|
+
class AlertRuleActionV3 < ApiModelBase
|
|
19
|
+
attr_accessor :create_incident
|
|
20
|
+
|
|
21
|
+
attr_accessor :escalate
|
|
22
|
+
|
|
23
|
+
# Identifier for this action, unique within the set. The server assigns one when it is omitted.
|
|
24
|
+
attr_accessor :id
|
|
25
|
+
|
|
26
|
+
attr_accessor :post_microsoft_teams
|
|
27
|
+
|
|
28
|
+
attr_accessor :post_slack
|
|
29
|
+
|
|
30
|
+
# Which action to take Known values: `escalate`, `post_slack`, `post_microsoft_teams`, `create_incident`, `investigate`
|
|
31
|
+
attr_accessor :type
|
|
32
|
+
|
|
33
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
34
|
+
def self.attribute_map
|
|
35
|
+
{
|
|
36
|
+
:'create_incident' => :'create_incident',
|
|
37
|
+
:'escalate' => :'escalate',
|
|
38
|
+
:'id' => :'id',
|
|
39
|
+
:'post_microsoft_teams' => :'post_microsoft_teams',
|
|
40
|
+
:'post_slack' => :'post_slack',
|
|
41
|
+
:'type' => :'type'
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns attribute mapping this model knows about
|
|
46
|
+
def self.acceptable_attribute_map
|
|
47
|
+
attribute_map
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Returns all the JSON keys this model knows about
|
|
51
|
+
def self.acceptable_attributes
|
|
52
|
+
acceptable_attribute_map.values
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
:'create_incident' => :'AlertRuleCreateIncidentActionV3',
|
|
59
|
+
:'escalate' => :'AlertRuleEscalateActionV3',
|
|
60
|
+
:'id' => :'String',
|
|
61
|
+
:'post_microsoft_teams' => :'AlertRulePostActionV3',
|
|
62
|
+
:'post_slack' => :'AlertRulePostActionV3',
|
|
63
|
+
:'type' => :'String'
|
|
64
|
+
}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# List of attributes with nullable: true
|
|
68
|
+
def self.openapi_nullable
|
|
69
|
+
Set.new([
|
|
70
|
+
])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Initializes the object
|
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
75
|
+
def initialize(attributes = {})
|
|
76
|
+
if (!attributes.is_a?(Hash))
|
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IncidentIo::AlertRuleActionV3` initialize method"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
81
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
83
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IncidentIo::AlertRuleActionV3`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
85
|
+
end
|
|
86
|
+
h[k.to_sym] = v
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if attributes.key?(:'create_incident')
|
|
90
|
+
self.create_incident = attributes[:'create_incident']
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'escalate')
|
|
94
|
+
self.escalate = attributes[:'escalate']
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
if attributes.key?(:'id')
|
|
98
|
+
self.id = attributes[:'id']
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'post_microsoft_teams')
|
|
102
|
+
self.post_microsoft_teams = attributes[:'post_microsoft_teams']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'post_slack')
|
|
106
|
+
self.post_slack = attributes[:'post_slack']
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'type')
|
|
110
|
+
self.type = attributes[:'type']
|
|
111
|
+
else
|
|
112
|
+
self.type = nil
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
117
|
+
# @return Array for valid properties with the reasons
|
|
118
|
+
def list_invalid_properties
|
|
119
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
120
|
+
invalid_properties = Array.new
|
|
121
|
+
if !@id.nil? && @id.to_s.length > 128
|
|
122
|
+
invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 128.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if !@id.nil? && @id.to_s.length < 1
|
|
126
|
+
invalid_properties.push('invalid value for "id", the character length must be greater than or equal to 1.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if @type.nil?
|
|
130
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
invalid_properties
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Check to see if the all the properties in the model are valid
|
|
137
|
+
# @return true if the model is valid
|
|
138
|
+
def valid?
|
|
139
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
140
|
+
return false if !@id.nil? && @id.to_s.length > 128
|
|
141
|
+
return false if !@id.nil? && @id.to_s.length < 1
|
|
142
|
+
return false if @type.nil?
|
|
143
|
+
true
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Custom attribute writer method with validation
|
|
147
|
+
# @param [Object] id Value to be assigned
|
|
148
|
+
def id=(id)
|
|
149
|
+
if id.nil?
|
|
150
|
+
fail ArgumentError, 'id cannot be nil'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if id.to_s.length > 128
|
|
154
|
+
fail ArgumentError, 'invalid value for "id", the character length must be smaller than or equal to 128.'
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if id.to_s.length < 1
|
|
158
|
+
fail ArgumentError, 'invalid value for "id", the character length must be greater than or equal to 1.'
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
@id = id
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Custom attribute writer method with validation
|
|
165
|
+
# @param [Object] type Value to be assigned
|
|
166
|
+
def type=(type)
|
|
167
|
+
if type.nil?
|
|
168
|
+
fail ArgumentError, 'type cannot be nil'
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
@type = type
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Checks equality by comparing each attribute.
|
|
175
|
+
# @param [Object] Object to be compared
|
|
176
|
+
def ==(o)
|
|
177
|
+
return true if self.equal?(o)
|
|
178
|
+
self.class == o.class &&
|
|
179
|
+
create_incident == o.create_incident &&
|
|
180
|
+
escalate == o.escalate &&
|
|
181
|
+
id == o.id &&
|
|
182
|
+
post_microsoft_teams == o.post_microsoft_teams &&
|
|
183
|
+
post_slack == o.post_slack &&
|
|
184
|
+
type == o.type
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# @see the `==` method
|
|
188
|
+
# @param [Object] Object to be compared
|
|
189
|
+
def eql?(o)
|
|
190
|
+
self == o
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Calculates hash code according to all attributes.
|
|
194
|
+
# @return [Integer] Hash code
|
|
195
|
+
def hash
|
|
196
|
+
[create_incident, escalate, id, post_microsoft_teams, post_slack, type].hash
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Builds the object from hash
|
|
200
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
201
|
+
# @return [Object] Returns the model itself
|
|
202
|
+
def self.build_from_hash(attributes)
|
|
203
|
+
return nil unless attributes.is_a?(Hash)
|
|
204
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
205
|
+
transformed_hash = {}
|
|
206
|
+
openapi_types.each_pair do |key, type|
|
|
207
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
208
|
+
transformed_hash["#{key}"] = nil
|
|
209
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
210
|
+
# check to ensure the input is an array given that the attribute
|
|
211
|
+
# is documented as an array but the input is not
|
|
212
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
213
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
214
|
+
end
|
|
215
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
216
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
new(transformed_hash)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Returns the object in the form of hash
|
|
223
|
+
# @return [Hash] Returns the object in the form of hash
|
|
224
|
+
def to_hash
|
|
225
|
+
hash = {}
|
|
226
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
227
|
+
value = self.send(attr)
|
|
228
|
+
if value.nil?
|
|
229
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
230
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
hash[param] = _to_hash(value)
|
|
234
|
+
end
|
|
235
|
+
hash
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
end
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#incident.io
|
|
3
|
+
|
|
4
|
+
#Ruby client for the incident.io API.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.25.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module IncidentIo
|
|
17
|
+
# One block of rules. Inside a block, the first branch whose conditions hold runs.
|
|
18
|
+
class AlertRuleBlockV3 < ApiModelBase
|
|
19
|
+
# One or two branches: an if branch, and optionally an else branch with no condition groups
|
|
20
|
+
attr_accessor :branches
|
|
21
|
+
|
|
22
|
+
# Identifier for this block, unique within the set. Choose a readable key and send the same one on every update, so the block keeps its identity.
|
|
23
|
+
attr_accessor :id
|
|
24
|
+
|
|
25
|
+
attr_accessor :message_template
|
|
26
|
+
|
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
|
+
def self.attribute_map
|
|
29
|
+
{
|
|
30
|
+
:'branches' => :'branches',
|
|
31
|
+
:'id' => :'id',
|
|
32
|
+
:'message_template' => :'message_template'
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns attribute mapping this model knows about
|
|
37
|
+
def self.acceptable_attribute_map
|
|
38
|
+
attribute_map
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns all the JSON keys this model knows about
|
|
42
|
+
def self.acceptable_attributes
|
|
43
|
+
acceptable_attribute_map.values
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Attribute type mapping.
|
|
47
|
+
def self.openapi_types
|
|
48
|
+
{
|
|
49
|
+
:'branches' => :'Array<AlertRuleBranchV3>',
|
|
50
|
+
:'id' => :'String',
|
|
51
|
+
:'message_template' => :'EngineParamBindingPayloadV3'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of attributes with nullable: true
|
|
56
|
+
def self.openapi_nullable
|
|
57
|
+
Set.new([
|
|
58
|
+
])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Initializes the object
|
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
63
|
+
def initialize(attributes = {})
|
|
64
|
+
if (!attributes.is_a?(Hash))
|
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `IncidentIo::AlertRuleBlockV3` initialize method"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
69
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `IncidentIo::AlertRuleBlockV3`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
73
|
+
end
|
|
74
|
+
h[k.to_sym] = v
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'branches')
|
|
78
|
+
if (value = attributes[:'branches']).is_a?(Array)
|
|
79
|
+
self.branches = value
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
self.branches = nil
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'id')
|
|
86
|
+
self.id = attributes[:'id']
|
|
87
|
+
else
|
|
88
|
+
self.id = nil
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'message_template')
|
|
92
|
+
self.message_template = attributes[:'message_template']
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
97
|
+
# @return Array for valid properties with the reasons
|
|
98
|
+
def list_invalid_properties
|
|
99
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
100
|
+
invalid_properties = Array.new
|
|
101
|
+
if @branches.nil?
|
|
102
|
+
invalid_properties.push('invalid value for "branches", branches cannot be nil.')
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if @id.nil?
|
|
106
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if @id.to_s.length > 128
|
|
110
|
+
invalid_properties.push('invalid value for "id", the character length must be smaller than or equal to 128.')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if @id.to_s.length < 1
|
|
114
|
+
invalid_properties.push('invalid value for "id", the character length must be greater than or equal to 1.')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
invalid_properties
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Check to see if the all the properties in the model are valid
|
|
121
|
+
# @return true if the model is valid
|
|
122
|
+
def valid?
|
|
123
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
124
|
+
return false if @branches.nil?
|
|
125
|
+
return false if @id.nil?
|
|
126
|
+
return false if @id.to_s.length > 128
|
|
127
|
+
return false if @id.to_s.length < 1
|
|
128
|
+
true
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Custom attribute writer method with validation
|
|
132
|
+
# @param [Object] branches Value to be assigned
|
|
133
|
+
def branches=(branches)
|
|
134
|
+
if branches.nil?
|
|
135
|
+
fail ArgumentError, 'branches cannot be nil'
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
@branches = branches
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Custom attribute writer method with validation
|
|
142
|
+
# @param [Object] id Value to be assigned
|
|
143
|
+
def id=(id)
|
|
144
|
+
if id.nil?
|
|
145
|
+
fail ArgumentError, 'id cannot be nil'
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if id.to_s.length > 128
|
|
149
|
+
fail ArgumentError, 'invalid value for "id", the character length must be smaller than or equal to 128.'
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if id.to_s.length < 1
|
|
153
|
+
fail ArgumentError, 'invalid value for "id", the character length must be greater than or equal to 1.'
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
@id = id
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Checks equality by comparing each attribute.
|
|
160
|
+
# @param [Object] Object to be compared
|
|
161
|
+
def ==(o)
|
|
162
|
+
return true if self.equal?(o)
|
|
163
|
+
self.class == o.class &&
|
|
164
|
+
branches == o.branches &&
|
|
165
|
+
id == o.id &&
|
|
166
|
+
message_template == o.message_template
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# @see the `==` method
|
|
170
|
+
# @param [Object] Object to be compared
|
|
171
|
+
def eql?(o)
|
|
172
|
+
self == o
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Calculates hash code according to all attributes.
|
|
176
|
+
# @return [Integer] Hash code
|
|
177
|
+
def hash
|
|
178
|
+
[branches, id, message_template].hash
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Builds the object from hash
|
|
182
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
183
|
+
# @return [Object] Returns the model itself
|
|
184
|
+
def self.build_from_hash(attributes)
|
|
185
|
+
return nil unless attributes.is_a?(Hash)
|
|
186
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
187
|
+
transformed_hash = {}
|
|
188
|
+
openapi_types.each_pair do |key, type|
|
|
189
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
190
|
+
transformed_hash["#{key}"] = nil
|
|
191
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
192
|
+
# check to ensure the input is an array given that the attribute
|
|
193
|
+
# is documented as an array but the input is not
|
|
194
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
195
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
196
|
+
end
|
|
197
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
198
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
new(transformed_hash)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Returns the object in the form of hash
|
|
205
|
+
# @return [Hash] Returns the object in the form of hash
|
|
206
|
+
def to_hash
|
|
207
|
+
hash = {}
|
|
208
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
209
|
+
value = self.send(attr)
|
|
210
|
+
if value.nil?
|
|
211
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
212
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
hash[param] = _to_hash(value)
|
|
216
|
+
end
|
|
217
|
+
hash
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
end
|