triglav_client 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -0
  3. data/Gemfile.lock +79 -0
  4. data/LICENSE +201 -0
  5. data/README.md +136 -0
  6. data/Rakefile +1 -0
  7. data/docs/AggregatedResourceEachResponse.md +11 -0
  8. data/docs/AuthApi.md +150 -0
  9. data/docs/BulkinsertResponse.md +8 -0
  10. data/docs/Credential.md +10 -0
  11. data/docs/ErrorModel.md +9 -0
  12. data/docs/JobEachResponse.md +12 -0
  13. data/docs/JobMessageEachResponse.md +11 -0
  14. data/docs/JobMessagesApi.md +117 -0
  15. data/docs/JobRequest.md +12 -0
  16. data/docs/JobResponse.md +14 -0
  17. data/docs/JobsApi.md +217 -0
  18. data/docs/LastJobMessageIdResponse.md +8 -0
  19. data/docs/LastMessageIdResponse.md +8 -0
  20. data/docs/MessageEachResponse.md +16 -0
  21. data/docs/MessageFetchRequest.md +10 -0
  22. data/docs/MessageRequest.md +13 -0
  23. data/docs/MessageResponse.md +16 -0
  24. data/docs/MessagesApi.md +170 -0
  25. data/docs/ResourceEachResponse.md +13 -0
  26. data/docs/ResourceRequest.md +15 -0
  27. data/docs/ResourceResponse.md +17 -0
  28. data/docs/ResourcesApi.md +335 -0
  29. data/docs/TokenResponse.md +9 -0
  30. data/docs/UserEachResponse.md +11 -0
  31. data/docs/UserRequest.md +13 -0
  32. data/docs/UserResponse.md +15 -0
  33. data/docs/UsersApi.md +274 -0
  34. data/example/example.rb +40 -0
  35. data/git_push.sh +67 -0
  36. data/lib/triglav_client.rb +77 -0
  37. data/lib/triglav_client/api/auth_api.rb +196 -0
  38. data/lib/triglav_client/api/job_messages_api.rb +153 -0
  39. data/lib/triglav_client/api/jobs_api.rb +257 -0
  40. data/lib/triglav_client/api/messages_api.rb +208 -0
  41. data/lib/triglav_client/api/resources_api.rb +379 -0
  42. data/lib/triglav_client/api/users_api.rb +318 -0
  43. data/lib/triglav_client/api_client.rb +379 -0
  44. data/lib/triglav_client/api_error.rb +47 -0
  45. data/lib/triglav_client/configuration.rb +214 -0
  46. data/lib/triglav_client/models/aggregated_resource_each_response.rb +230 -0
  47. data/lib/triglav_client/models/bulkinsert_response.rb +200 -0
  48. data/lib/triglav_client/models/credential.rb +252 -0
  49. data/lib/triglav_client/models/error_model.rb +212 -0
  50. data/lib/triglav_client/models/job_each_response.rb +235 -0
  51. data/lib/triglav_client/models/job_message_each_response.rb +229 -0
  52. data/lib/triglav_client/models/job_request.rb +241 -0
  53. data/lib/triglav_client/models/job_response.rb +259 -0
  54. data/lib/triglav_client/models/last_job_message_id_response.rb +200 -0
  55. data/lib/triglav_client/models/last_message_id_response.rb +200 -0
  56. data/lib/triglav_client/models/message_each_response.rb +281 -0
  57. data/lib/triglav_client/models/message_fetch_request.rb +223 -0
  58. data/lib/triglav_client/models/message_request.rb +254 -0
  59. data/lib/triglav_client/models/message_response.rb +281 -0
  60. data/lib/triglav_client/models/resource_each_response.rb +250 -0
  61. data/lib/triglav_client/models/resource_request.rb +269 -0
  62. data/lib/triglav_client/models/resource_response.rb +287 -0
  63. data/lib/triglav_client/models/token_response.rb +208 -0
  64. data/lib/triglav_client/models/user_each_response.rb +262 -0
  65. data/lib/triglav_client/models/user_request.rb +280 -0
  66. data/lib/triglav_client/models/user_response.rb +300 -0
  67. data/lib/triglav_client/version.rb +26 -0
  68. data/spec/api/auth_api_spec.rb +80 -0
  69. data/spec/api/job_messages_api_spec.rb +71 -0
  70. data/spec/api/jobs_api_spec.rb +93 -0
  71. data/spec/api/messages_api_spec.rb +74 -0
  72. data/spec/api/resources_api_spec.rb +109 -0
  73. data/spec/api/users_api_spec.rb +106 -0
  74. data/spec/api_client_spec.rb +237 -0
  75. data/spec/configuration_spec.rb +53 -0
  76. data/spec/models/aggregated_resource_each_response_spec.rb +71 -0
  77. data/spec/models/bulkinsert_response_spec.rb +53 -0
  78. data/spec/models/credential_spec.rb +69 -0
  79. data/spec/models/error_model_spec.rb +59 -0
  80. data/spec/models/job_each_response_spec.rb +77 -0
  81. data/spec/models/job_message_each_response_spec.rb +65 -0
  82. data/spec/models/job_request_spec.rb +71 -0
  83. data/spec/models/job_response_spec.rb +89 -0
  84. data/spec/models/last_job_message_id_response_spec.rb +53 -0
  85. data/spec/models/last_message_id_response_spec.rb +53 -0
  86. data/spec/models/message_each_response_spec.rb +89 -0
  87. data/spec/models/message_fetch_request_spec.rb +65 -0
  88. data/spec/models/message_request_spec.rb +59 -0
  89. data/spec/models/message_response_spec.rb +89 -0
  90. data/spec/models/resource_each_response_spec.rb +71 -0
  91. data/spec/models/resource_request_spec.rb +83 -0
  92. data/spec/models/resource_response_spec.rb +101 -0
  93. data/spec/models/token_response_spec.rb +59 -0
  94. data/spec/models/user_each_response_spec.rb +75 -0
  95. data/spec/models/user_request_spec.rb +87 -0
  96. data/spec/models/user_response_spec.rb +99 -0
  97. data/spec/spec_helper.rb +122 -0
  98. data/triglav_client.gemspec +55 -0
  99. metadata +351 -0
@@ -0,0 +1,281 @@
1
+ =begin
2
+ #Triglav API
3
+
4
+ #Triglav API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: triglav_admin_my@dena.jp
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module TriglavClient
27
+
28
+ class MessageResponse
29
+ # Universally Unique ID to be used to avoid duplicated messages
30
+ attr_accessor :uuid
31
+
32
+ # URI of Resource
33
+ attr_accessor :resource_uri
34
+
35
+ # Time unit of resource to monitor such as singular, daily, or hourly
36
+ attr_accessor :resource_unit
37
+
38
+ # Time of Resource in unix timestamp such as 1476025200 (2016-10-10 in +09:00)
39
+ attr_accessor :resource_time
40
+
41
+ # Timezone of resource time, that is, timezone of %Y-%m-%d for hdfs://path/to/%Y-%m-%d such as +09:00
42
+ attr_accessor :resource_timezone
43
+
44
+ # Any json string
45
+ attr_accessor :payload
46
+
47
+ attr_accessor :id
48
+
49
+ attr_accessor :created_at
50
+
51
+ attr_accessor :updated_at
52
+
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'uuid' => :'uuid',
58
+ :'resource_uri' => :'resource_uri',
59
+ :'resource_unit' => :'resource_unit',
60
+ :'resource_time' => :'resource_time',
61
+ :'resource_timezone' => :'resource_timezone',
62
+ :'payload' => :'payload',
63
+ :'id' => :'id',
64
+ :'created_at' => :'created_at',
65
+ :'updated_at' => :'updated_at'
66
+ }
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.swagger_types
71
+ {
72
+ :'uuid' => :'String',
73
+ :'resource_uri' => :'String',
74
+ :'resource_unit' => :'String',
75
+ :'resource_time' => :'Integer',
76
+ :'resource_timezone' => :'String',
77
+ :'payload' => :'String',
78
+ :'id' => :'Integer',
79
+ :'created_at' => :'DateTime',
80
+ :'updated_at' => :'DateTime'
81
+ }
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ return unless attributes.is_a?(Hash)
88
+
89
+ # convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
91
+
92
+ if attributes.has_key?(:'uuid')
93
+ self.uuid = attributes[:'uuid']
94
+ end
95
+
96
+ if attributes.has_key?(:'resource_uri')
97
+ self.resource_uri = attributes[:'resource_uri']
98
+ end
99
+
100
+ if attributes.has_key?(:'resource_unit')
101
+ self.resource_unit = attributes[:'resource_unit']
102
+ end
103
+
104
+ if attributes.has_key?(:'resource_time')
105
+ self.resource_time = attributes[:'resource_time']
106
+ end
107
+
108
+ if attributes.has_key?(:'resource_timezone')
109
+ self.resource_timezone = attributes[:'resource_timezone']
110
+ end
111
+
112
+ if attributes.has_key?(:'payload')
113
+ self.payload = attributes[:'payload']
114
+ end
115
+
116
+ if attributes.has_key?(:'id')
117
+ self.id = attributes[:'id']
118
+ end
119
+
120
+ if attributes.has_key?(:'created_at')
121
+ self.created_at = attributes[:'created_at']
122
+ end
123
+
124
+ if attributes.has_key?(:'updated_at')
125
+ self.updated_at = attributes[:'updated_at']
126
+ end
127
+
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properies with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ return invalid_properties
135
+ end
136
+
137
+ # Check to see if the all the properties in the model are valid
138
+ # @return true if the model is valid
139
+ def valid?
140
+ return false if @resource_uri.nil?
141
+ return false if @resource_unit.nil?
142
+ return false if @resource_time.nil?
143
+ return false if @resource_timezone.nil?
144
+ return true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ uuid == o.uuid &&
153
+ resource_uri == o.resource_uri &&
154
+ resource_unit == o.resource_unit &&
155
+ resource_time == o.resource_time &&
156
+ resource_timezone == o.resource_timezone &&
157
+ payload == o.payload &&
158
+ id == o.id &&
159
+ created_at == o.created_at &&
160
+ updated_at == o.updated_at
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Fixnum] Hash code
171
+ def hash
172
+ [uuid, resource_uri, resource_unit, resource_time, resource_timezone, payload, id, created_at, updated_at].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ self.class.swagger_types.each_pair do |key, type|
181
+ if type =~ /^Array<(.*)>/i
182
+ # check to ensure the input is an array given that the the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
185
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
186
+ end
187
+ elsif !attributes[self.class.attribute_map[key]].nil?
188
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
190
+ end
191
+
192
+ self
193
+ end
194
+
195
+ # Deserializes the data based on type
196
+ # @param string type Data type
197
+ # @param string value Value to be deserialized
198
+ # @return [Object] Deserialized data
199
+ def _deserialize(type, value)
200
+ case type.to_sym
201
+ when :DateTime
202
+ DateTime.parse(value)
203
+ when :Date
204
+ Date.parse(value)
205
+ when :String
206
+ value.to_s
207
+ when :Integer
208
+ value.to_i
209
+ when :Float
210
+ value.to_f
211
+ when :BOOLEAN
212
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
213
+ true
214
+ else
215
+ false
216
+ end
217
+ when :Object
218
+ # generic object (usually a Hash), return directly
219
+ value
220
+ when /\AArray<(?<inner_type>.+)>\z/
221
+ inner_type = Regexp.last_match[:inner_type]
222
+ value.map { |v| _deserialize(inner_type, v) }
223
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
224
+ k_type = Regexp.last_match[:k_type]
225
+ v_type = Regexp.last_match[:v_type]
226
+ {}.tap do |hash|
227
+ value.each do |k, v|
228
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229
+ end
230
+ end
231
+ else # model
232
+ temp_model = TriglavClient.const_get(type).new
233
+ temp_model.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ next if value.nil?
256
+ hash[param] = _to_hash(value)
257
+ end
258
+ hash
259
+ end
260
+
261
+ # Outputs non-array value in the form of hash
262
+ # For object, use to_hash. Otherwise, just return the value
263
+ # @param [Object] value Any valid value
264
+ # @return [Hash] Returns the value in the form of hash
265
+ def _to_hash(value)
266
+ if value.is_a?(Array)
267
+ value.compact.map{ |v| _to_hash(v) }
268
+ elsif value.is_a?(Hash)
269
+ {}.tap do |hash|
270
+ value.each { |k, v| hash[k] = _to_hash(v) }
271
+ end
272
+ elsif value.respond_to? :to_hash
273
+ value.to_hash
274
+ else
275
+ value
276
+ end
277
+ end
278
+
279
+ end
280
+
281
+ end
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #Triglav API
3
+
4
+ #Triglav API
5
+
6
+ OpenAPI spec version: 1.0.0
7
+ Contact: triglav_admin_my@dena.jp
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module TriglavClient
27
+
28
+ class ResourceEachResponse
29
+ # resource uri
30
+ attr_accessor :uri
31
+
32
+ # 'singualr' or 'daily' or 'hourly'
33
+ attr_accessor :unit
34
+
35
+ # timezone of the format [+-]HH:MM
36
+ attr_accessor :timezone
37
+
38
+ # span in days
39
+ attr_accessor :span_in_days
40
+
41
+ # True if this resource should be consumed
42
+ attr_accessor :consumable
43
+
44
+ # True if a job notifies its end of task to triglav for this resource, that is, monitoring in agent is not necessary
45
+ attr_accessor :notifiable
46
+
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'uri' => :'uri',
52
+ :'unit' => :'unit',
53
+ :'timezone' => :'timezone',
54
+ :'span_in_days' => :'span_in_days',
55
+ :'consumable' => :'consumable',
56
+ :'notifiable' => :'notifiable'
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ :'uri' => :'String',
64
+ :'unit' => :'String',
65
+ :'timezone' => :'String',
66
+ :'span_in_days' => :'Integer',
67
+ :'consumable' => :'BOOLEAN',
68
+ :'notifiable' => :'BOOLEAN'
69
+ }
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
79
+
80
+ if attributes.has_key?(:'uri')
81
+ self.uri = attributes[:'uri']
82
+ end
83
+
84
+ if attributes.has_key?(:'unit')
85
+ self.unit = attributes[:'unit']
86
+ end
87
+
88
+ if attributes.has_key?(:'timezone')
89
+ self.timezone = attributes[:'timezone']
90
+ end
91
+
92
+ if attributes.has_key?(:'span_in_days')
93
+ self.span_in_days = attributes[:'span_in_days']
94
+ end
95
+
96
+ if attributes.has_key?(:'consumable')
97
+ self.consumable = attributes[:'consumable']
98
+ end
99
+
100
+ if attributes.has_key?(:'notifiable')
101
+ self.notifiable = attributes[:'notifiable']
102
+ end
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properies with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ return invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ return true
117
+ end
118
+
119
+ # Checks equality by comparing each attribute.
120
+ # @param [Object] Object to be compared
121
+ def ==(o)
122
+ return true if self.equal?(o)
123
+ self.class == o.class &&
124
+ uri == o.uri &&
125
+ unit == o.unit &&
126
+ timezone == o.timezone &&
127
+ span_in_days == o.span_in_days &&
128
+ consumable == o.consumable &&
129
+ notifiable == o.notifiable
130
+ end
131
+
132
+ # @see the `==` method
133
+ # @param [Object] Object to be compared
134
+ def eql?(o)
135
+ self == o
136
+ end
137
+
138
+ # Calculates hash code according to all attributes.
139
+ # @return [Fixnum] Hash code
140
+ def hash
141
+ [uri, unit, timezone, span_in_days, consumable, notifiable].hash
142
+ end
143
+
144
+ # Builds the object from hash
145
+ # @param [Hash] attributes Model attributes in the form of hash
146
+ # @return [Object] Returns the model itself
147
+ def build_from_hash(attributes)
148
+ return nil unless attributes.is_a?(Hash)
149
+ self.class.swagger_types.each_pair do |key, type|
150
+ if type =~ /^Array<(.*)>/i
151
+ # check to ensure the input is an array given that the the attribute
152
+ # is documented as an array but the input is not
153
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
155
+ end
156
+ elsif !attributes[self.class.attribute_map[key]].nil?
157
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
158
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
159
+ end
160
+
161
+ self
162
+ end
163
+
164
+ # Deserializes the data based on type
165
+ # @param string type Data type
166
+ # @param string value Value to be deserialized
167
+ # @return [Object] Deserialized data
168
+ def _deserialize(type, value)
169
+ case type.to_sym
170
+ when :DateTime
171
+ DateTime.parse(value)
172
+ when :Date
173
+ Date.parse(value)
174
+ when :String
175
+ value.to_s
176
+ when :Integer
177
+ value.to_i
178
+ when :Float
179
+ value.to_f
180
+ when :BOOLEAN
181
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
182
+ true
183
+ else
184
+ false
185
+ end
186
+ when :Object
187
+ # generic object (usually a Hash), return directly
188
+ value
189
+ when /\AArray<(?<inner_type>.+)>\z/
190
+ inner_type = Regexp.last_match[:inner_type]
191
+ value.map { |v| _deserialize(inner_type, v) }
192
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
193
+ k_type = Regexp.last_match[:k_type]
194
+ v_type = Regexp.last_match[:v_type]
195
+ {}.tap do |hash|
196
+ value.each do |k, v|
197
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
198
+ end
199
+ end
200
+ else # model
201
+ temp_model = TriglavClient.const_get(type).new
202
+ temp_model.build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
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 = self.send(attr)
224
+ next if value.nil?
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map{ |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end