SematextCloud 0.1.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.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +13 -0
  4. data/README.md +149 -0
  5. data/Rakefile +8 -0
  6. data/SematextCloud.gemspec +45 -0
  7. data/docs/AlertNotificationRequest.md +9 -0
  8. data/docs/AlertNotificationsApi.md +118 -0
  9. data/docs/AlertRule.md +53 -0
  10. data/docs/AlertRuleScheduleTimeRangeDto.md +7 -0
  11. data/docs/AlertRuleScheduleWeekdayDto.md +10 -0
  12. data/docs/AlertsApi.md +270 -0
  13. data/docs/App.md +32 -0
  14. data/docs/AppDescription.md +6 -0
  15. data/docs/AppMetadata.md +10 -0
  16. data/docs/AppsApi.md +369 -0
  17. data/docs/AwsSettingsControllerApi.md +63 -0
  18. data/docs/BasicAuthMethodDto.md +7 -0
  19. data/docs/BasicOrganizationDto.md +9 -0
  20. data/docs/BillingApi.md +176 -0
  21. data/docs/BillingInfo.md +8 -0
  22. data/docs/CloudWatchSettings.md +9 -0
  23. data/docs/CreateAppInfo.md +10 -0
  24. data/docs/DataSeriesFilter.md +8 -0
  25. data/docs/DataSeriesRequest.md +12 -0
  26. data/docs/Error.md +7 -0
  27. data/docs/FilterValue.md +11 -0
  28. data/docs/GenericApiResponse.md +9 -0
  29. data/docs/Invitation.md +15 -0
  30. data/docs/LogsAppApi.md +58 -0
  31. data/docs/MetricsApi.md +227 -0
  32. data/docs/MonitoringAppApi.md +58 -0
  33. data/docs/NotificationIntegration.md +15 -0
  34. data/docs/Plan.md +18 -0
  35. data/docs/ReportInfo.md +13 -0
  36. data/docs/ResetPasswordApi.md +58 -0
  37. data/docs/SavedQueriesApi.md +220 -0
  38. data/docs/SavedQuery.md +18 -0
  39. data/docs/ServiceIntegration.md +17 -0
  40. data/docs/SubscriptionsApi.md +114 -0
  41. data/docs/TagApiControllerApi.md +212 -0
  42. data/docs/UpdateAppInfo.md +14 -0
  43. data/docs/UserInfo.md +6 -0
  44. data/docs/UserPermissions.md +8 -0
  45. data/docs/UserRole.md +8 -0
  46. data/lib/SematextCloud.rb +78 -0
  47. data/lib/SematextCloud/api/alert_notifications_api.rb +137 -0
  48. data/lib/SematextCloud/api/alerts_api.rb +283 -0
  49. data/lib/SematextCloud/api/apps_api.rb +381 -0
  50. data/lib/SematextCloud/api/aws_settings_controller_api.rb +83 -0
  51. data/lib/SematextCloud/api/billing_api.rb +197 -0
  52. data/lib/SematextCloud/api/logs_app_api.rb +75 -0
  53. data/lib/SematextCloud/api/metrics_api.rb +247 -0
  54. data/lib/SematextCloud/api/monitoring_app_api.rb +75 -0
  55. data/lib/SematextCloud/api/reset_password_api.rb +75 -0
  56. data/lib/SematextCloud/api/saved_queries_api.rb +237 -0
  57. data/lib/SematextCloud/api/subscriptions_api.rb +133 -0
  58. data/lib/SematextCloud/api/tag_api_controller_api.rb +247 -0
  59. data/lib/SematextCloud/api_client.rb +389 -0
  60. data/lib/SematextCloud/api_error.rb +38 -0
  61. data/lib/SematextCloud/configuration.rb +209 -0
  62. data/lib/SematextCloud/models/alert_notification_request.rb +212 -0
  63. data/lib/SematextCloud/models/alert_rule.rb +652 -0
  64. data/lib/SematextCloud/models/alert_rule_schedule_time_range_dto.rb +192 -0
  65. data/lib/SematextCloud/models/alert_rule_schedule_weekday_dto.rb +221 -0
  66. data/lib/SematextCloud/models/app.rb +419 -0
  67. data/lib/SematextCloud/models/app_description.rb +183 -0
  68. data/lib/SematextCloud/models/app_metadata.rb +268 -0
  69. data/lib/SematextCloud/models/basic_auth_method_dto.rb +226 -0
  70. data/lib/SematextCloud/models/basic_organization_dto.rb +246 -0
  71. data/lib/SematextCloud/models/billing_info.rb +201 -0
  72. data/lib/SematextCloud/models/cloud_watch_settings.rb +256 -0
  73. data/lib/SematextCloud/models/create_app_info.rb +220 -0
  74. data/lib/SematextCloud/models/data_series_filter.rb +237 -0
  75. data/lib/SematextCloud/models/data_series_request.rb +283 -0
  76. data/lib/SematextCloud/models/error.rb +192 -0
  77. data/lib/SematextCloud/models/filter_value.rb +230 -0
  78. data/lib/SematextCloud/models/generic_api_response.rb +214 -0
  79. data/lib/SematextCloud/models/invitation.rb +326 -0
  80. data/lib/SematextCloud/models/notification_integration.rb +324 -0
  81. data/lib/SematextCloud/models/plan.rb +337 -0
  82. data/lib/SematextCloud/models/report_info.rb +247 -0
  83. data/lib/SematextCloud/models/saved_query.rb +291 -0
  84. data/lib/SematextCloud/models/service_integration.rb +282 -0
  85. data/lib/SematextCloud/models/update_app_info.rb +289 -0
  86. data/lib/SematextCloud/models/user_info.rb +183 -0
  87. data/lib/SematextCloud/models/user_permissions.rb +201 -0
  88. data/lib/SematextCloud/models/user_role.rb +247 -0
  89. data/lib/SematextCloud/version.rb +15 -0
  90. data/spec/api/alert_notifications_api_spec.rb +60 -0
  91. data/spec/api/alerts_api_spec.rb +90 -0
  92. data/spec/api/apps_api_spec.rb +113 -0
  93. data/spec/api/aws_settings_controller_api_spec.rb +48 -0
  94. data/spec/api/billing_api_spec.rb +72 -0
  95. data/spec/api/logs_app_api_spec.rb +46 -0
  96. data/spec/api/metrics_api_spec.rb +83 -0
  97. data/spec/api/monitoring_app_api_spec.rb +46 -0
  98. data/spec/api/reset_password_api_spec.rb +46 -0
  99. data/spec/api/saved_queries_api_spec.rb +80 -0
  100. data/spec/api/subscriptions_api_spec.rb +58 -0
  101. data/spec/api/tag_api_controller_api_spec.rb +88 -0
  102. data/spec/api_client_spec.rb +226 -0
  103. data/spec/configuration_spec.rb +42 -0
  104. data/spec/models/alert_notification_request_spec.rb +59 -0
  105. data/spec/models/alert_rule_schedule_time_range_dto_spec.rb +47 -0
  106. data/spec/models/alert_rule_schedule_weekday_dto_spec.rb +65 -0
  107. data/spec/models/alert_rule_spec.rb +327 -0
  108. data/spec/models/app_description_spec.rb +41 -0
  109. data/spec/models/app_metadata_spec.rb +77 -0
  110. data/spec/models/app_spec.rb +197 -0
  111. data/spec/models/basic_auth_method_dto_spec.rb +51 -0
  112. data/spec/models/basic_organization_dto_spec.rb +63 -0
  113. data/spec/models/billing_info_spec.rb +53 -0
  114. data/spec/models/cloud_watch_settings_spec.rb +67 -0
  115. data/spec/models/create_app_info_spec.rb +65 -0
  116. data/spec/models/data_series_filter_spec.rb +57 -0
  117. data/spec/models/data_series_request_spec.rb +81 -0
  118. data/spec/models/error_spec.rb +47 -0
  119. data/spec/models/filter_value_spec.rb +71 -0
  120. data/spec/models/generic_api_response_spec.rb +59 -0
  121. data/spec/models/invitation_spec.rb +107 -0
  122. data/spec/models/notification_integration_spec.rb +107 -0
  123. data/spec/models/plan_spec.rb +121 -0
  124. data/spec/models/report_info_spec.rb +83 -0
  125. data/spec/models/saved_query_spec.rb +113 -0
  126. data/spec/models/service_integration_spec.rb +107 -0
  127. data/spec/models/update_app_info_spec.rb +93 -0
  128. data/spec/models/user_info_spec.rb +41 -0
  129. data/spec/models/user_permissions_spec.rb +53 -0
  130. data/spec/models/user_role_spec.rb +61 -0
  131. data/spec/spec_helper.rb +111 -0
  132. metadata +395 -0
@@ -0,0 +1,324 @@
1
+ =begin
2
+ #Sematext Cloud API
3
+
4
+ #API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`.
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SematextCloud
16
+ class NotificationIntegration
17
+ attr_accessor :applicability
18
+
19
+ attr_accessor :create_date
20
+
21
+ attr_accessor :created_by_owner
22
+
23
+ attr_accessor :creator_id
24
+
25
+ attr_accessor :id
26
+
27
+ attr_accessor :integration_type
28
+
29
+ attr_accessor :name
30
+
31
+ attr_accessor :params
32
+
33
+ attr_accessor :state
34
+
35
+ attr_accessor :user_id
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'applicability' => :'applicability',
63
+ :'create_date' => :'createDate',
64
+ :'created_by_owner' => :'createdByOwner',
65
+ :'creator_id' => :'creatorId',
66
+ :'id' => :'id',
67
+ :'integration_type' => :'integrationType',
68
+ :'name' => :'name',
69
+ :'params' => :'params',
70
+ :'state' => :'state',
71
+ :'user_id' => :'userId'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.swagger_types
77
+ {
78
+ :'applicability' => :'String',
79
+ :'create_date' => :'DateTime',
80
+ :'created_by_owner' => :'BOOLEAN',
81
+ :'creator_id' => :'Integer',
82
+ :'id' => :'Integer',
83
+ :'integration_type' => :'String',
84
+ :'name' => :'String',
85
+ :'params' => :'Hash<String, String>',
86
+ :'state' => :'String',
87
+ :'user_id' => :'Integer'
88
+ }
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ return unless attributes.is_a?(Hash)
95
+
96
+ # convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
98
+
99
+ if attributes.has_key?(:'applicability')
100
+ self.applicability = attributes[:'applicability']
101
+ end
102
+
103
+ if attributes.has_key?(:'createDate')
104
+ self.create_date = attributes[:'createDate']
105
+ end
106
+
107
+ if attributes.has_key?(:'createdByOwner')
108
+ self.created_by_owner = attributes[:'createdByOwner']
109
+ end
110
+
111
+ if attributes.has_key?(:'creatorId')
112
+ self.creator_id = attributes[:'creatorId']
113
+ end
114
+
115
+ if attributes.has_key?(:'id')
116
+ self.id = attributes[:'id']
117
+ end
118
+
119
+ if attributes.has_key?(:'integrationType')
120
+ self.integration_type = attributes[:'integrationType']
121
+ end
122
+
123
+ if attributes.has_key?(:'name')
124
+ self.name = attributes[:'name']
125
+ end
126
+
127
+ if attributes.has_key?(:'params')
128
+ if (value = attributes[:'params']).is_a?(Hash)
129
+ self.params = value
130
+ end
131
+ end
132
+
133
+ if attributes.has_key?(:'state')
134
+ self.state = attributes[:'state']
135
+ end
136
+
137
+ if attributes.has_key?(:'userId')
138
+ self.user_id = attributes[:'userId']
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ applicability_validator = EnumAttributeValidator.new('String', ['NONE', 'USE_ALWAYS'])
153
+ return false unless applicability_validator.valid?(@applicability)
154
+ integration_type_validator = EnumAttributeValidator.new('String', ['PAGER_DUTY', 'NAGIOS', 'WEB_HOOKS', 'WEB_HOOKS_TEMPLATE', 'HIP_CHAT', 'EMAIL_LIST', 'TEMPORARY_EMAIL_LIST'])
155
+ return false unless integration_type_validator.valid?(@integration_type)
156
+ state_validator = EnumAttributeValidator.new('String', ['ACTIVE', 'DISABLED', 'DELETED'])
157
+ return false unless state_validator.valid?(@state)
158
+ true
159
+ end
160
+
161
+ # Custom attribute writer method checking allowed values (enum).
162
+ # @param [Object] applicability Object to be assigned
163
+ def applicability=(applicability)
164
+ validator = EnumAttributeValidator.new('String', ['NONE', 'USE_ALWAYS'])
165
+ unless validator.valid?(applicability)
166
+ fail ArgumentError, 'invalid value for "applicability", must be one of #{validator.allowable_values}.'
167
+ end
168
+ @applicability = applicability
169
+ end
170
+
171
+ # Custom attribute writer method checking allowed values (enum).
172
+ # @param [Object] integration_type Object to be assigned
173
+ def integration_type=(integration_type)
174
+ validator = EnumAttributeValidator.new('String', ['PAGER_DUTY', 'NAGIOS', 'WEB_HOOKS', 'WEB_HOOKS_TEMPLATE', 'HIP_CHAT', 'EMAIL_LIST', 'TEMPORARY_EMAIL_LIST'])
175
+ unless validator.valid?(integration_type)
176
+ fail ArgumentError, 'invalid value for "integration_type", must be one of #{validator.allowable_values}.'
177
+ end
178
+ @integration_type = integration_type
179
+ end
180
+
181
+ # Custom attribute writer method checking allowed values (enum).
182
+ # @param [Object] state Object to be assigned
183
+ def state=(state)
184
+ validator = EnumAttributeValidator.new('String', ['ACTIVE', 'DISABLED', 'DELETED'])
185
+ unless validator.valid?(state)
186
+ fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.'
187
+ end
188
+ @state = state
189
+ end
190
+
191
+ # Checks equality by comparing each attribute.
192
+ # @param [Object] Object to be compared
193
+ def ==(o)
194
+ return true if self.equal?(o)
195
+ self.class == o.class &&
196
+ applicability == o.applicability &&
197
+ create_date == o.create_date &&
198
+ created_by_owner == o.created_by_owner &&
199
+ creator_id == o.creator_id &&
200
+ id == o.id &&
201
+ integration_type == o.integration_type &&
202
+ name == o.name &&
203
+ params == o.params &&
204
+ state == o.state &&
205
+ user_id == o.user_id
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Fixnum] Hash code
216
+ def hash
217
+ [applicability, create_date, created_by_owner, creator_id, id, integration_type, name, params, state, user_id].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ self.class.swagger_types.each_pair do |key, type|
226
+ if type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
230
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
231
+ end
232
+ elsif !attributes[self.class.attribute_map[key]].nil?
233
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ # Deserializes the data based on type
241
+ # @param string type Data type
242
+ # @param string value Value to be deserialized
243
+ # @return [Object] Deserialized data
244
+ def _deserialize(type, value)
245
+ case type.to_sym
246
+ when :DateTime
247
+ DateTime.parse(value)
248
+ when :Date
249
+ Date.parse(value)
250
+ when :String
251
+ value.to_s
252
+ when :Integer
253
+ value.to_i
254
+ when :Float
255
+ value.to_f
256
+ when :BOOLEAN
257
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
+ true
259
+ else
260
+ false
261
+ end
262
+ when :Object
263
+ # generic object (usually a Hash), return directly
264
+ value
265
+ when /\AArray<(?<inner_type>.+)>\z/
266
+ inner_type = Regexp.last_match[:inner_type]
267
+ value.map { |v| _deserialize(inner_type, v) }
268
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
269
+ k_type = Regexp.last_match[:k_type]
270
+ v_type = Regexp.last_match[:v_type]
271
+ {}.tap do |hash|
272
+ value.each do |k, v|
273
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
274
+ end
275
+ end
276
+ else # model
277
+ temp_model = SematextCloud.const_get(type).new
278
+ temp_model.build_from_hash(value)
279
+ end
280
+ end
281
+
282
+ # Returns the string representation of the object
283
+ # @return [String] String presentation of the object
284
+ def to_s
285
+ to_hash.to_s
286
+ end
287
+
288
+ # to_body is an alias to to_hash (backward compatibility)
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_body
291
+ to_hash
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ next if value.nil?
301
+ hash[param] = _to_hash(value)
302
+ end
303
+ hash
304
+ end
305
+
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+ end
324
+ end
@@ -0,0 +1,337 @@
1
+ =begin
2
+ #Sematext Cloud API
3
+
4
+ #API Explorer provides access and documentation for Sematext REST API. The REST API requires the API Key to be sent as part of `Authorization` header. E.g.: `Authorization : apiKey e5f18450-205a-48eb-8589-7d49edaea813`.
5
+
6
+ OpenAPI spec version: v3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.12
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SematextCloud
16
+ class Plan
17
+ attr_accessor :app_type
18
+
19
+ attr_accessor :custom
20
+
21
+ attr_accessor :data_retention_hours
22
+
23
+ attr_accessor :default_trial_plan
24
+
25
+ attr_accessor :free
26
+
27
+ attr_accessor :free_trial_days
28
+
29
+ attr_accessor :id
30
+
31
+ attr_accessor :max_alerts
32
+
33
+ attr_accessor :max_daily_events
34
+
35
+ attr_accessor :name
36
+
37
+ attr_accessor :plan_scheme
38
+
39
+ attr_accessor :sematext_service
40
+
41
+ attr_accessor :trial_plan
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'app_type' => :'appType',
69
+ :'custom' => :'custom',
70
+ :'data_retention_hours' => :'dataRetentionHours',
71
+ :'default_trial_plan' => :'defaultTrialPlan',
72
+ :'free' => :'free',
73
+ :'free_trial_days' => :'freeTrialDays',
74
+ :'id' => :'id',
75
+ :'max_alerts' => :'maxAlerts',
76
+ :'max_daily_events' => :'maxDailyEvents',
77
+ :'name' => :'name',
78
+ :'plan_scheme' => :'planScheme',
79
+ :'sematext_service' => :'sematextService',
80
+ :'trial_plan' => :'trialPlan'
81
+ }
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.swagger_types
86
+ {
87
+ :'app_type' => :'String',
88
+ :'custom' => :'BOOLEAN',
89
+ :'data_retention_hours' => :'Float',
90
+ :'default_trial_plan' => :'BOOLEAN',
91
+ :'free' => :'BOOLEAN',
92
+ :'free_trial_days' => :'Integer',
93
+ :'id' => :'Integer',
94
+ :'max_alerts' => :'Integer',
95
+ :'max_daily_events' => :'Integer',
96
+ :'name' => :'String',
97
+ :'plan_scheme' => :'String',
98
+ :'sematext_service' => :'String',
99
+ :'trial_plan' => :'BOOLEAN'
100
+ }
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ return unless attributes.is_a?(Hash)
107
+
108
+ # convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
110
+
111
+ if attributes.has_key?(:'appType')
112
+ self.app_type = attributes[:'appType']
113
+ end
114
+
115
+ if attributes.has_key?(:'custom')
116
+ self.custom = attributes[:'custom']
117
+ end
118
+
119
+ if attributes.has_key?(:'dataRetentionHours')
120
+ self.data_retention_hours = attributes[:'dataRetentionHours']
121
+ end
122
+
123
+ if attributes.has_key?(:'defaultTrialPlan')
124
+ self.default_trial_plan = attributes[:'defaultTrialPlan']
125
+ end
126
+
127
+ if attributes.has_key?(:'free')
128
+ self.free = attributes[:'free']
129
+ end
130
+
131
+ if attributes.has_key?(:'freeTrialDays')
132
+ self.free_trial_days = attributes[:'freeTrialDays']
133
+ end
134
+
135
+ if attributes.has_key?(:'id')
136
+ self.id = attributes[:'id']
137
+ end
138
+
139
+ if attributes.has_key?(:'maxAlerts')
140
+ self.max_alerts = attributes[:'maxAlerts']
141
+ end
142
+
143
+ if attributes.has_key?(:'maxDailyEvents')
144
+ self.max_daily_events = attributes[:'maxDailyEvents']
145
+ end
146
+
147
+ if attributes.has_key?(:'name')
148
+ self.name = attributes[:'name']
149
+ end
150
+
151
+ if attributes.has_key?(:'planScheme')
152
+ self.plan_scheme = attributes[:'planScheme']
153
+ end
154
+
155
+ if attributes.has_key?(:'sematextService')
156
+ self.sematext_service = attributes[:'sematextService']
157
+ end
158
+
159
+ if attributes.has_key?(:'trialPlan')
160
+ self.trial_plan = attributes[:'trialPlan']
161
+ end
162
+ end
163
+
164
+ # Show invalid properties with the reasons. Usually used together with valid?
165
+ # @return Array for valid properties with the reasons
166
+ def list_invalid_properties
167
+ invalid_properties = Array.new
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ plan_scheme_validator = EnumAttributeValidator.new('String', ['SPM_1_0', 'SPM_2_0', 'SA_1_0', 'SEARCHENE_1_0', 'LOGSENE_1_0', 'LOGSENE_2_0', 'RUM_1_0', 'RUM_EA', 'SYNTHETICS_1_0'])
175
+ return false unless plan_scheme_validator.valid?(@plan_scheme)
176
+ sematext_service_validator = EnumAttributeValidator.new('String', ['LOGSENE', 'SPM', 'RUM', 'SYNTHETICS'])
177
+ return false unless sematext_service_validator.valid?(@sematext_service)
178
+ true
179
+ end
180
+
181
+ # Custom attribute writer method checking allowed values (enum).
182
+ # @param [Object] plan_scheme Object to be assigned
183
+ def plan_scheme=(plan_scheme)
184
+ validator = EnumAttributeValidator.new('String', ['SPM_1_0', 'SPM_2_0', 'SA_1_0', 'SEARCHENE_1_0', 'LOGSENE_1_0', 'LOGSENE_2_0', 'RUM_1_0', 'RUM_EA', 'SYNTHETICS_1_0'])
185
+ unless validator.valid?(plan_scheme)
186
+ fail ArgumentError, 'invalid value for "plan_scheme", must be one of #{validator.allowable_values}.'
187
+ end
188
+ @plan_scheme = plan_scheme
189
+ end
190
+
191
+ # Custom attribute writer method checking allowed values (enum).
192
+ # @param [Object] sematext_service Object to be assigned
193
+ def sematext_service=(sematext_service)
194
+ validator = EnumAttributeValidator.new('String', ['LOGSENE', 'SPM', 'RUM', 'SYNTHETICS'])
195
+ unless validator.valid?(sematext_service)
196
+ fail ArgumentError, 'invalid value for "sematext_service", must be one of #{validator.allowable_values}.'
197
+ end
198
+ @sematext_service = sematext_service
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ app_type == o.app_type &&
207
+ custom == o.custom &&
208
+ data_retention_hours == o.data_retention_hours &&
209
+ default_trial_plan == o.default_trial_plan &&
210
+ free == o.free &&
211
+ free_trial_days == o.free_trial_days &&
212
+ id == o.id &&
213
+ max_alerts == o.max_alerts &&
214
+ max_daily_events == o.max_daily_events &&
215
+ name == o.name &&
216
+ plan_scheme == o.plan_scheme &&
217
+ sematext_service == o.sematext_service &&
218
+ trial_plan == o.trial_plan
219
+ end
220
+
221
+ # @see the `==` method
222
+ # @param [Object] Object to be compared
223
+ def eql?(o)
224
+ self == o
225
+ end
226
+
227
+ # Calculates hash code according to all attributes.
228
+ # @return [Fixnum] Hash code
229
+ def hash
230
+ [app_type, custom, data_retention_hours, default_trial_plan, free, free_trial_days, id, max_alerts, max_daily_events, name, plan_scheme, sematext_service, trial_plan].hash
231
+ end
232
+
233
+ # Builds the object from hash
234
+ # @param [Hash] attributes Model attributes in the form of hash
235
+ # @return [Object] Returns the model itself
236
+ def build_from_hash(attributes)
237
+ return nil unless attributes.is_a?(Hash)
238
+ self.class.swagger_types.each_pair do |key, type|
239
+ if type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
243
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
244
+ end
245
+ elsif !attributes[self.class.attribute_map[key]].nil?
246
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
247
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
248
+ end
249
+
250
+ self
251
+ end
252
+
253
+ # Deserializes the data based on type
254
+ # @param string type Data type
255
+ # @param string value Value to be deserialized
256
+ # @return [Object] Deserialized data
257
+ def _deserialize(type, value)
258
+ case type.to_sym
259
+ when :DateTime
260
+ DateTime.parse(value)
261
+ when :Date
262
+ Date.parse(value)
263
+ when :String
264
+ value.to_s
265
+ when :Integer
266
+ value.to_i
267
+ when :Float
268
+ value.to_f
269
+ when :BOOLEAN
270
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
271
+ true
272
+ else
273
+ false
274
+ end
275
+ when :Object
276
+ # generic object (usually a Hash), return directly
277
+ value
278
+ when /\AArray<(?<inner_type>.+)>\z/
279
+ inner_type = Regexp.last_match[:inner_type]
280
+ value.map { |v| _deserialize(inner_type, v) }
281
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
282
+ k_type = Regexp.last_match[:k_type]
283
+ v_type = Regexp.last_match[:v_type]
284
+ {}.tap do |hash|
285
+ value.each do |k, v|
286
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
287
+ end
288
+ end
289
+ else # model
290
+ temp_model = SematextCloud.const_get(type).new
291
+ temp_model.build_from_hash(value)
292
+ end
293
+ end
294
+
295
+ # Returns the string representation of the object
296
+ # @return [String] String presentation of the object
297
+ def to_s
298
+ to_hash.to_s
299
+ end
300
+
301
+ # to_body is an alias to to_hash (backward compatibility)
302
+ # @return [Hash] Returns the object in the form of hash
303
+ def to_body
304
+ to_hash
305
+ end
306
+
307
+ # Returns the object in the form of hash
308
+ # @return [Hash] Returns the object in the form of hash
309
+ def to_hash
310
+ hash = {}
311
+ self.class.attribute_map.each_pair do |attr, param|
312
+ value = self.send(attr)
313
+ next if value.nil?
314
+ hash[param] = _to_hash(value)
315
+ end
316
+ hash
317
+ end
318
+
319
+ # Outputs non-array value in the form of hash
320
+ # For object, use to_hash. Otherwise, just return the value
321
+ # @param [Object] value Any valid value
322
+ # @return [Hash] Returns the value in the form of hash
323
+ def _to_hash(value)
324
+ if value.is_a?(Array)
325
+ value.compact.map { |v| _to_hash(v) }
326
+ elsif value.is_a?(Hash)
327
+ {}.tap do |hash|
328
+ value.each { |k, v| hash[k] = _to_hash(v) }
329
+ end
330
+ elsif value.respond_to? :to_hash
331
+ value.to_hash
332
+ else
333
+ value
334
+ end
335
+ end
336
+ end
337
+ end