Class: VSphereAutomation::Content::LibraryItemDownloadSessionApi

Inherits:
Object
  • Object
show all
Defined in:
lib/vsphere-automation-content/api/library_item_download_session_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LibraryItemDownloadSessionApi

Returns a new instance of LibraryItemDownloadSessionApi.



16
17
18
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#cancel(download_session_id, opts = {}) ⇒ |VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil

Cancels the download session. This operation will abort any ongoing transfers and invalidate transfer urls that the client may be downloading from.

Parameters:

  • download_session_id

    Identifer of the download session that should be canceled.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



23
24
25
26
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 23

def cancel(download_session_id, opts = {})
  cancel_with_http_info(download_session_id, opts)
  nil
end

#cancel_with_http_info(download_session_id, opts = {}) ⇒ Array<(|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Cancels the download session. This operation will abort any ongoing transfers and invalidate transfer urls that the client may be downloading from.

Parameters:

  • download_session_id

    Identifer of the download session that should be canceled.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 33

def cancel_with_http_info(download_session_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.cancel ...'
  end
  # verify the required parameter 'download_session_id' is set
  if @api_client.config.client_side_validation && download_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_session_id' when calling LibraryItemDownloadSessionApi.cancel"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session/id:{download_session_id}?~action=cancel'.sub('{' + 'download_session_id' + '}', download_session_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#cancel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create(request_body, opts = {}) ⇒ ContentLibraryItemDownloadSessionCreateResult|VapiStdErrorsInvalidArgumentError|VapiStdErrorsNotFoundError|

Creates a new download session.

Parameters:

  • request_body
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



73
74
75
76
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 73

def create(request_body, opts = {})
  data, _status_code, _headers = create_with_http_info(request_body, opts)
  data
end

#create_with_http_info(request_body, opts = {}) ⇒ Array<(ContentLibraryItemDownloadSessionCreateResult|VapiStdErrorsInvalidArgumentError|VapiStdErrorsNotFoundError|, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new download session.

Parameters:

  • request_body
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 83

def create_with_http_info(request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.create ...'
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling LibraryItemDownloadSessionApi.create"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request_body)
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
	:return_type => {
	  '200' => 'Content::ContentLibraryItemDownloadSessionCreateResult',
	  '400' => 'Content::VapiStdErrorsInvalidArgumentError',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete(download_session_id, opts = {}) ⇒ |VapiStdErrorsNotFoundError|nil

Deletes a download session. This removes the session and all information associated with it. <p> Removing a download session leaves any current transfers for that session in an indeterminate state (there is no guarantee that the transfers will be able to complete). However there will no longer be a means of inspecting the status of those downloads except by seeing the effect on the library item. <p> Download sessions for which there is no download activity or which are complete will automatically be expired and then deleted after a period of time.

Parameters:

  • download_session_id

    Identifier of the download session to be deleted.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



130
131
132
133
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 130

def delete(download_session_id, opts = {})
  delete_with_http_info(download_session_id, opts)
  nil
end

#delete_with_http_info(download_session_id, opts = {}) ⇒ Array<(|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deletes a download session. This removes the session and all information associated with it. &lt;p&gt; Removing a download session leaves any current transfers for that session in an indeterminate state (there is no guarantee that the transfers will be able to complete). However there will no longer be a means of inspecting the status of those downloads except by seeing the effect on the library item. &lt;p&gt; Download sessions for which there is no download activity or which are complete will automatically be expired and then deleted after a period of time.

Parameters:

  • download_session_id

    Identifier of the download session to be deleted.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
167
168
169
170
171
172
173
174
175
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 140

def delete_with_http_info(download_session_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.delete ...'
  end
  # verify the required parameter 'download_session_id' is set
  if @api_client.config.client_side_validation && download_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_session_id' when calling LibraryItemDownloadSessionApi.delete"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session/id:{download_session_id}'.sub('{' + 'download_session_id' + '}', download_session_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#fail(download_session_id, request_body, opts = {}) ⇒ |VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil

Terminates the download session with a client specified error message. <p> This is useful in transmitting client side failures (for example, not being able to download a file) to the server side.

Parameters:

  • download_session_id

    Identifier of the download session to fail.

  • request_body
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



181
182
183
184
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 181

def fail(download_session_id, request_body, opts = {})
  fail_with_http_info(download_session_id, request_body, opts)
  nil
end

#fail_with_http_info(download_session_id, request_body, opts = {}) ⇒ Array<(|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Terminates the download session with a client specified error message. &lt;p&gt; This is useful in transmitting client side failures (for example, not being able to download a file) to the server side.

Parameters:

  • download_session_id

    Identifier of the download session to fail.

  • request_body
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 192

def fail_with_http_info(download_session_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.fail ...'
  end
  # verify the required parameter 'download_session_id' is set
  if @api_client.config.client_side_validation && download_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_session_id' when calling LibraryItemDownloadSessionApi.fail"
  end
  # verify the required parameter 'request_body' is set
  if @api_client.config.client_side_validation && request_body.nil?
    fail ArgumentError, "Missing the required parameter 'request_body' when calling LibraryItemDownloadSessionApi.fail"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session/id:{download_session_id}?~action=fail'.sub('{' + 'download_session_id' + '}', download_session_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request_body)
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#fail\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get(download_session_id, opts = {}) ⇒ ContentLibraryItemDownloadSessionResult|VapiStdErrorsNotFoundError|

Gets the download session with the specified identifier, including the most up-to-date status information for the session.

Parameters:

  • download_session_id

    Identifier of the download session to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



238
239
240
241
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 238

def get(download_session_id, opts = {})
  data, _status_code, _headers = get_with_http_info(download_session_id, opts)
  data
end

#get_with_http_info(download_session_id, opts = {}) ⇒ Array<(ContentLibraryItemDownloadSessionResult|VapiStdErrorsNotFoundError|, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Gets the download session with the specified identifier, including the most up-to-date status information for the session.

Parameters:

  • download_session_id

    Identifier of the download session to retrieve.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 248

def get_with_http_info(download_session_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.get ...'
  end
  # verify the required parameter 'download_session_id' is set
  if @api_client.config.client_side_validation && download_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_session_id' when calling LibraryItemDownloadSessionApi.get"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session/id:{download_session_id}'.sub('{' + 'download_session_id' + '}', download_session_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
	:return_type => {
	  '200' => 'Content::ContentLibraryItemDownloadSessionResult',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#keep_alive(download_session_id, opts = {}) ⇒ |VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil

Keeps a download session alive. This operation is allowed only if the session is in the DownloadSessionModel.State#ACTIVE state. <p> If there is no activity for a download session for a certain period of time, the download session will expire. The download session expiration timeout is configurable in the Content Library Service system configuration. The default is five minutes. Invoking this operation enables a client to specifically extend the lifetime of an active download session.

Parameters:

  • download_session_id

    Identifier of the download session whose lifetime should be extended.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



293
294
295
296
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 293

def keep_alive(download_session_id, opts = {})
  keep_alive_with_http_info(download_session_id, opts)
  nil
end

#keep_alive_with_http_info(download_session_id, opts = {}) ⇒ Array<(|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|nil, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Keeps a download session alive. This operation is allowed only if the session is in the DownloadSessionModel.State#ACTIVE state. &lt;p&gt; If there is no activity for a download session for a certain period of time, the download session will expire. The download session expiration timeout is configurable in the Content Library Service system configuration. The default is five minutes. Invoking this operation enables a client to specifically extend the lifetime of an active download session.

Parameters:

  • download_session_id

    Identifier of the download session whose lifetime should be extended.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 304

def keep_alive_with_http_info(download_session_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.keep_alive ...'
  end
  # verify the required parameter 'download_session_id' is set
  if @api_client.config.client_side_validation && download_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'download_session_id' when calling LibraryItemDownloadSessionApi.keep_alive"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session/id:{download_session_id}?~action=keep-alive'.sub('{' + 'download_session_id' + '}', download_session_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'request_body'])
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#keep_alive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list(opts = {}) ⇒ ContentLibraryItemDownloadSessionListResult|VapiStdErrorsNotFoundError|

Lists the identifiers of the download sessions created by the calling user. Optionally may filter by library item.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :library_item_id (String)

    Library item identifier on which to filter results.

Returns:



346
347
348
349
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 346

def list(opts = {})
  data, _status_code, _headers = list_with_http_info(opts)
  data
end

#list_with_http_info(opts = {}) ⇒ Array<(ContentLibraryItemDownloadSessionListResult|VapiStdErrorsNotFoundError|, Fixnum, Hash)>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Lists the identifiers of the download sessions created by the calling user. Optionally may filter by library item.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :library_item_id (String)

    Library item identifier on which to filter results.

Returns:



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/vsphere-automation-content/api/library_item_download_session_api.rb', line 356

def list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemDownloadSessionApi.list ...'
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/download-session'

  # query parameters
  query_params = {}
  query_params[:'library_item_id'] = opts[:'library_item_id'] if !opts[:'library_item_id'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api_key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
	:return_type => {
	  '200' => 'Content::ContentLibraryItemDownloadSessionListResult',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemDownloadSessionApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end