Class: Falcon::LookupFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/api/lookup_files.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LookupFiles



36
37
38
# File 'lib/crimson-falcon/api/lookup_files.rb', line 36

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



34
35
36
# File 'lib/crimson-falcon/api/lookup_files.rb', line 34

def api_client
  @api_client
end

Instance Method Details

#create_file_v1(file, name, opts = {}) ⇒ DomainLookupFileWrapper

Creates a lookup file

Options Hash (opts):

  • :x_cs_username (String)

    Requester Username.

  • :x_cs_useruuid (String)

    Requester UUID.

  • :description (String)

    File description

  • :id (String)

    Unique identifier of the file being updated.

  • :repo (String)

    Name of repository or view to save the file



49
50
51
52
# File 'lib/crimson-falcon/api/lookup_files.rb', line 49

def create_file_v1(file, name, opts = {})
  data, _status_code, _headers = create_file_v1_with_http_info(file, name, opts)
  data
end

#create_file_v1_with_http_info(file, name, opts = {}) ⇒ Array<(DomainLookupFileWrapper, Integer, Hash)>

Creates a lookup file

Options Hash (opts):

  • :x_cs_username (String)

    Requester Username.

  • :x_cs_useruuid (String)

    Requester UUID.

  • :description (String)

    File description

  • :id (String)

    Unique identifier of the file being updated.

  • :repo (String)

    Name of repository or view to save the file



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/crimson-falcon/api/lookup_files.rb', line 64

def create_file_v1_with_http_info(file, name, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LookupFiles.create_file_v1 ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling LookupFiles.create_file_v1"
  end
  # verify the required parameter 'name' is set
  if @api_client.config.client_side_validation && name.nil?
    fail ArgumentError, "Missing the required parameter 'name' when calling LookupFiles.create_file_v1"
  end
  if @api_client.config.client_side_validation && name.to_s.length > 50
    fail ArgumentError, 'invalid value for "name" when calling LookupFiles.create_file_v1, the character length must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && name.to_s.length < 5
    fail ArgumentError, 'invalid value for "name" when calling LookupFiles.create_file_v1, the character length must be great than or equal to 5.'
  end

  if @api_client.config.client_side_validation && !opts[:'x_cs_useruuid'].nil? && opts[:'x_cs_useruuid'].to_s.length > 36
    fail ArgumentError, 'invalid value for "opts[:"x_cs_useruuid"]" when calling LookupFiles.create_file_v1, the character length must be smaller than or equal to 36.'
  end

  if @api_client.config.client_side_validation && !opts[:'x_cs_useruuid'].nil? && opts[:'x_cs_useruuid'].to_s.length < 36
    fail ArgumentError, 'invalid value for "opts[:"x_cs_useruuid"]" when calling LookupFiles.create_file_v1, the character length must be great than or equal to 36.'
  end

  if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"description"]" when calling LookupFiles.create_file_v1, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length < 5
    fail ArgumentError, 'invalid value for "opts[:"description"]" when calling LookupFiles.create_file_v1, the character length must be great than or equal to 5.'
  end

  if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].to_s.length > 32
    fail ArgumentError, 'invalid value for "opts[:"id"]" when calling LookupFiles.create_file_v1, the character length must be smaller than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].to_s.length < 32
    fail ArgumentError, 'invalid value for "opts[:"id"]" when calling LookupFiles.create_file_v1, the character length must be great than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'repo'].nil? && opts[:'repo'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"repo"]" when calling LookupFiles.create_file_v1, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && !opts[:'repo'].nil? && opts[:'repo'].to_s.length < 5
    fail ArgumentError, 'invalid value for "opts[:"repo"]" when calling LookupFiles.create_file_v1, the character length must be great than or equal to 5.'
  end

  # resource path
  local_var_path = '/loggingapi/entities/lookup-files/v1'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end
  header_params[:'X-CS-USERNAME'] = opts[:'x_cs_username'] if !opts[:'x_cs_username'].nil?
  header_params[:'X-CS-USERUUID'] = opts[:'x_cs_useruuid'] if !opts[:'x_cs_useruuid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file
  form_params['name'] = name
  form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['id'] = opts[:'id'] if !opts[:'id'].nil?
  form_params['repo'] = opts[:'repo'] if !opts[:'repo'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DomainLookupFileWrapper'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"LookupFiles.create_file_v1",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LookupFiles#create_file_v1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_file_v1(id, opts = {}) ⇒ DomainLookupFileWrapper

Updates a lookup file

Options Hash (opts):

  • :x_cs_username (String)

    Requester Username.

  • :x_cs_useruuid (String)

    Requester UUID.

  • :description (String)

    File description

  • :file (File)

    File to be uploaded



176
177
178
179
# File 'lib/crimson-falcon/api/lookup_files.rb', line 176

def update_file_v1(id, opts = {})
  data, _status_code, _headers = update_file_v1_with_http_info(id, opts)
  data
end

#update_file_v1_with_http_info(id, opts = {}) ⇒ Array<(DomainLookupFileWrapper, Integer, Hash)>

Updates a lookup file

Options Hash (opts):

  • :x_cs_username (String)

    Requester Username.

  • :x_cs_useruuid (String)

    Requester UUID.

  • :description (String)

    File description

  • :file (File)

    File to be uploaded



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/crimson-falcon/api/lookup_files.rb', line 189

def update_file_v1_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LookupFiles.update_file_v1 ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling LookupFiles.update_file_v1"
  end
  if @api_client.config.client_side_validation && id.to_s.length < 32
    fail ArgumentError, 'invalid value for "id" when calling LookupFiles.update_file_v1, the character length must be great than or equal to 32.'
  end

  if @api_client.config.client_side_validation && !opts[:'x_cs_useruuid'].nil? && opts[:'x_cs_useruuid'].to_s.length > 36
    fail ArgumentError, 'invalid value for "opts[:"x_cs_useruuid"]" when calling LookupFiles.update_file_v1, the character length must be smaller than or equal to 36.'
  end

  if @api_client.config.client_side_validation && !opts[:'x_cs_useruuid'].nil? && opts[:'x_cs_useruuid'].to_s.length < 36
    fail ArgumentError, 'invalid value for "opts[:"x_cs_useruuid"]" when calling LookupFiles.update_file_v1, the character length must be great than or equal to 36.'
  end

  if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"description"]" when calling LookupFiles.update_file_v1, the character length must be smaller than or equal to 255.'
  end

  if @api_client.config.client_side_validation && !opts[:'description'].nil? && opts[:'description'].to_s.length < 5
    fail ArgumentError, 'invalid value for "opts[:"description"]" when calling LookupFiles.update_file_v1, the character length must be great than or equal to 5.'
  end

  # resource path
  local_var_path = '/loggingapi/entities/lookup-files/v1'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
    header_params['Content-Type'] = content_type
  end
  header_params[:'X-CS-USERNAME'] = opts[:'x_cs_username'] if !opts[:'x_cs_username'].nil?
  header_params[:'X-CS-USERUUID'] = opts[:'x_cs_useruuid'] if !opts[:'x_cs_useruuid'].nil?

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['id'] = id
  form_params['description'] = opts[:'description'] if !opts[:'description'].nil?
  form_params['file'] = opts[:'file'] if !opts[:'file'].nil?

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DomainLookupFileWrapper'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"LookupFiles.update_file_v1",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LookupFiles#update_file_v1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end