autosde_openapi_client 1.1.12 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,254 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module AutosdeOpenapiClient
16
+ class EventApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # @param [Hash] opts the optional parameters
23
+ # @return [Array<Event>]
24
+ def events_get(opts = {})
25
+ data, _status_code, _headers = events_get_with_http_info(opts)
26
+ data
27
+ end
28
+
29
+ # @param [Hash] opts the optional parameters
30
+ # @return [Array<(Array<Event>, Integer, Hash)>] Array<Event> data, response status code and response headers
31
+ def events_get_with_http_info(opts = {})
32
+ if @api_client.config.debugging
33
+ @api_client.config.logger.debug 'Calling API: EventApi.events_get ...'
34
+ end
35
+ # resource path
36
+ local_var_path = '/events'
37
+
38
+ # query parameters
39
+ query_params = opts[:query_params] || {}
40
+
41
+ # header parameters
42
+ header_params = opts[:header_params] || {}
43
+ # HTTP header 'Accept' (if needed)
44
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
45
+
46
+ # form parameters
47
+ form_params = opts[:form_params] || {}
48
+
49
+ # http body (model)
50
+ post_body = opts[:debug_body]
51
+
52
+ # return_type
53
+ return_type = opts[:debug_return_type] || 'Array<Event>'
54
+
55
+ # auth_names
56
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
57
+
58
+ new_options = opts.merge(
59
+ :operation => :"EventApi.events_get",
60
+ :header_params => header_params,
61
+ :query_params => query_params,
62
+ :form_params => form_params,
63
+ :body => post_body,
64
+ :auth_names => auth_names,
65
+ :return_type => return_type
66
+ )
67
+
68
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
69
+ if @api_client.config.debugging
70
+ @api_client.config.logger.debug "API called: EventApi#events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
71
+ end
72
+ return data, status_code, headers
73
+ end
74
+
75
+ # @param pk [Integer]
76
+ # @param [Hash] opts the optional parameters
77
+ # @return [Array<Event>]
78
+ def events_pk_delete(pk, opts = {})
79
+ data, _status_code, _headers = events_pk_delete_with_http_info(pk, opts)
80
+ data
81
+ end
82
+
83
+ # @param pk [Integer]
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [Array<(Array<Event>, Integer, Hash)>] Array<Event> data, response status code and response headers
86
+ def events_pk_delete_with_http_info(pk, opts = {})
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug 'Calling API: EventApi.events_pk_delete ...'
89
+ end
90
+ # verify the required parameter 'pk' is set
91
+ if @api_client.config.client_side_validation && pk.nil?
92
+ fail ArgumentError, "Missing the required parameter 'pk' when calling EventApi.events_pk_delete"
93
+ end
94
+ # resource path
95
+ local_var_path = '/events/{pk}'.sub('{' + 'pk' + '}', CGI.escape(pk.to_s))
96
+
97
+ # query parameters
98
+ query_params = opts[:query_params] || {}
99
+
100
+ # header parameters
101
+ header_params = opts[:header_params] || {}
102
+ # HTTP header 'Accept' (if needed)
103
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
104
+
105
+ # form parameters
106
+ form_params = opts[:form_params] || {}
107
+
108
+ # http body (model)
109
+ post_body = opts[:debug_body]
110
+
111
+ # return_type
112
+ return_type = opts[:debug_return_type] || 'Array<Event>'
113
+
114
+ # auth_names
115
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
116
+
117
+ new_options = opts.merge(
118
+ :operation => :"EventApi.events_pk_delete",
119
+ :header_params => header_params,
120
+ :query_params => query_params,
121
+ :form_params => form_params,
122
+ :body => post_body,
123
+ :auth_names => auth_names,
124
+ :return_type => return_type
125
+ )
126
+
127
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
128
+ if @api_client.config.debugging
129
+ @api_client.config.logger.debug "API called: EventApi#events_pk_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
+ end
131
+ return data, status_code, headers
132
+ end
133
+
134
+ # @param pk [Integer]
135
+ # @param [Hash] opts the optional parameters
136
+ # @return [Array<Event>]
137
+ def events_pk_get(pk, opts = {})
138
+ data, _status_code, _headers = events_pk_get_with_http_info(pk, opts)
139
+ data
140
+ end
141
+
142
+ # @param pk [Integer]
143
+ # @param [Hash] opts the optional parameters
144
+ # @return [Array<(Array<Event>, Integer, Hash)>] Array<Event> data, response status code and response headers
145
+ def events_pk_get_with_http_info(pk, opts = {})
146
+ if @api_client.config.debugging
147
+ @api_client.config.logger.debug 'Calling API: EventApi.events_pk_get ...'
148
+ end
149
+ # verify the required parameter 'pk' is set
150
+ if @api_client.config.client_side_validation && pk.nil?
151
+ fail ArgumentError, "Missing the required parameter 'pk' when calling EventApi.events_pk_get"
152
+ end
153
+ # resource path
154
+ local_var_path = '/events/{pk}'.sub('{' + 'pk' + '}', CGI.escape(pk.to_s))
155
+
156
+ # query parameters
157
+ query_params = opts[:query_params] || {}
158
+
159
+ # header parameters
160
+ header_params = opts[:header_params] || {}
161
+ # HTTP header 'Accept' (if needed)
162
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
163
+
164
+ # form parameters
165
+ form_params = opts[:form_params] || {}
166
+
167
+ # http body (model)
168
+ post_body = opts[:debug_body]
169
+
170
+ # return_type
171
+ return_type = opts[:debug_return_type] || 'Array<Event>'
172
+
173
+ # auth_names
174
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
175
+
176
+ new_options = opts.merge(
177
+ :operation => :"EventApi.events_pk_get",
178
+ :header_params => header_params,
179
+ :query_params => query_params,
180
+ :form_params => form_params,
181
+ :body => post_body,
182
+ :auth_names => auth_names,
183
+ :return_type => return_type
184
+ )
185
+
186
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
187
+ if @api_client.config.debugging
188
+ @api_client.config.logger.debug "API called: EventApi#events_pk_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
189
+ end
190
+ return data, status_code, headers
191
+ end
192
+
193
+ # @param event [Event]
194
+ # @param [Hash] opts the optional parameters
195
+ # @return [Event]
196
+ def events_post(event, opts = {})
197
+ data, _status_code, _headers = events_post_with_http_info(event, opts)
198
+ data
199
+ end
200
+
201
+ # @param event [Event]
202
+ # @param [Hash] opts the optional parameters
203
+ # @return [Array<(Event, Integer, Hash)>] Event data, response status code and response headers
204
+ def events_post_with_http_info(event, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: EventApi.events_post ...'
207
+ end
208
+ # verify the required parameter 'event' is set
209
+ if @api_client.config.client_side_validation && event.nil?
210
+ fail ArgumentError, "Missing the required parameter 'event' when calling EventApi.events_post"
211
+ end
212
+ # resource path
213
+ local_var_path = '/events'
214
+
215
+ # query parameters
216
+ query_params = opts[:query_params] || {}
217
+
218
+ # header parameters
219
+ header_params = opts[:header_params] || {}
220
+ # HTTP header 'Accept' (if needed)
221
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
222
+ # HTTP header 'Content-Type'
223
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
224
+
225
+ # form parameters
226
+ form_params = opts[:form_params] || {}
227
+
228
+ # http body (model)
229
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(event)
230
+
231
+ # return_type
232
+ return_type = opts[:debug_return_type] || 'Event'
233
+
234
+ # auth_names
235
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
236
+
237
+ new_options = opts.merge(
238
+ :operation => :"EventApi.events_post",
239
+ :header_params => header_params,
240
+ :query_params => query_params,
241
+ :form_params => form_params,
242
+ :body => post_body,
243
+ :auth_names => auth_names,
244
+ :return_type => return_type
245
+ )
246
+
247
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
248
+ if @api_client.config.debugging
249
+ @api_client.config.logger.debug "API called: EventApi#events_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
250
+ end
251
+ return data, status_code, headers
252
+ end
253
+ end
254
+ end
@@ -0,0 +1,83 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module AutosdeOpenapiClient
16
+ class ValidateSystemApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # @param storage_system_create [StorageSystemCreate]
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [ValidateSystem]
25
+ def validate_system_post(storage_system_create, opts = {})
26
+ data, _status_code, _headers = validate_system_post_with_http_info(storage_system_create, opts)
27
+ data
28
+ end
29
+
30
+ # @param storage_system_create [StorageSystemCreate]
31
+ # @param [Hash] opts the optional parameters
32
+ # @return [Array<(ValidateSystem, Integer, Hash)>] ValidateSystem data, response status code and response headers
33
+ def validate_system_post_with_http_info(storage_system_create, opts = {})
34
+ if @api_client.config.debugging
35
+ @api_client.config.logger.debug 'Calling API: ValidateSystemApi.validate_system_post ...'
36
+ end
37
+ # verify the required parameter 'storage_system_create' is set
38
+ if @api_client.config.client_side_validation && storage_system_create.nil?
39
+ fail ArgumentError, "Missing the required parameter 'storage_system_create' when calling ValidateSystemApi.validate_system_post"
40
+ end
41
+ # resource path
42
+ local_var_path = '/validate-system'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
51
+ # HTTP header 'Content-Type'
52
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(storage_system_create)
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type] || 'ValidateSystem'
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"ValidateSystemApi.validate_system_post",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: ValidateSystemApi#validate_system_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,289 @@
1
+ =begin
2
+ #Site Manager API
3
+
4
+ #Site Manager API
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: autosde@il.ibm.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module AutosdeOpenapiClient
17
+ # Event object represents storage system alerts and messages.
18
+ class Event
19
+ # description
20
+ attr_accessor :description
21
+
22
+ # error_code
23
+ attr_accessor :error_code
24
+
25
+ # event_id
26
+ attr_accessor :event_id
27
+
28
+ # event_type
29
+ attr_accessor :event_type
30
+
31
+ # fixed
32
+ attr_accessor :fixed
33
+
34
+ # last_timestamp
35
+ attr_accessor :last_timestamp
36
+
37
+ attr_accessor :storage_system
38
+
39
+ # uuid
40
+ attr_accessor :uuid
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'description' => :'description',
46
+ :'error_code' => :'error_code',
47
+ :'event_id' => :'event_id',
48
+ :'event_type' => :'event_type',
49
+ :'fixed' => :'fixed',
50
+ :'last_timestamp' => :'last_timestamp',
51
+ :'storage_system' => :'storage_system',
52
+ :'uuid' => :'uuid'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'description' => :'String',
65
+ :'error_code' => :'String',
66
+ :'event_id' => :'Integer',
67
+ :'event_type' => :'String',
68
+ :'fixed' => :'String',
69
+ :'last_timestamp' => :'Time',
70
+ :'storage_system' => :'StorageSystem',
71
+ :'uuid' => :'String'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AutosdeOpenapiClient::Event` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AutosdeOpenapiClient::Event`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'description')
97
+ self.description = attributes[:'description']
98
+ end
99
+
100
+ if attributes.key?(:'error_code')
101
+ self.error_code = attributes[:'error_code']
102
+ end
103
+
104
+ if attributes.key?(:'event_id')
105
+ self.event_id = attributes[:'event_id']
106
+ end
107
+
108
+ if attributes.key?(:'event_type')
109
+ self.event_type = attributes[:'event_type']
110
+ end
111
+
112
+ if attributes.key?(:'fixed')
113
+ self.fixed = attributes[:'fixed']
114
+ end
115
+
116
+ if attributes.key?(:'last_timestamp')
117
+ self.last_timestamp = attributes[:'last_timestamp']
118
+ end
119
+
120
+ if attributes.key?(:'storage_system')
121
+ self.storage_system = attributes[:'storage_system']
122
+ end
123
+
124
+ if attributes.key?(:'uuid')
125
+ self.uuid = attributes[:'uuid']
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
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
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ description == o.description &&
148
+ error_code == o.error_code &&
149
+ event_id == o.event_id &&
150
+ event_type == o.event_type &&
151
+ fixed == o.fixed &&
152
+ last_timestamp == o.last_timestamp &&
153
+ storage_system == o.storage_system &&
154
+ uuid == o.uuid
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [description, error_code, event_id, event_type, fixed, last_timestamp, storage_system, uuid].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ new.build_from_hash(attributes)
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ self.class.openapi_types.each_pair do |key, type|
182
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
183
+ self.send("#{key}=", nil)
184
+ elsif type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
188
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
192
+ end
193
+ end
194
+
195
+ self
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def _deserialize(type, value)
203
+ case type.to_sym
204
+ when :Time
205
+ Time.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :Boolean
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ # models (e.g. Pet) or oneOf
236
+ klass = AutosdeOpenapiClient.const_get(type)
237
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
238
+ end
239
+ end
240
+
241
+ # Returns the string representation of the object
242
+ # @return [String] String presentation of the object
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_hash (backward compatibility)
248
+ # @return [Hash] Returns the object in the form of hash
249
+ def to_body
250
+ to_hash
251
+ end
252
+
253
+ # Returns the object in the form of hash
254
+ # @return [Hash] Returns the object in the form of hash
255
+ def to_hash
256
+ hash = {}
257
+ self.class.attribute_map.each_pair do |attr, param|
258
+ value = self.send(attr)
259
+ if value.nil?
260
+ is_nullable = self.class.openapi_nullable.include?(attr)
261
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
262
+ end
263
+
264
+ hash[param] = _to_hash(value)
265
+ end
266
+ hash
267
+ end
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+
287
+ end
288
+
289
+ end