Class: VSphereAutomation::Content::LibraryItemUpdatesessionFileApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ LibraryItemUpdatesessionFileApi

Returns a new instance of LibraryItemUpdatesessionFileApi.



16
17
18
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_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_updatesession_file_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#add(update_session_id, request_body, opts = {}) ⇒ ContentLibraryItemUpdatesessionFileAddResult|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|

Requests file content to be changed (either created, or updated). Depending on the source type of the file, this operation will either return an upload endpoint where the client can push the content, or the server will pull from the provided source endpoint. If a file with the same name already exists in this session, this operation will be used to update the content of the existing file. <p> When importing a file directly from storage, where the source endpoint is a file or datastore URI, you will need to have the ContentLibrary.ReadStorage privilege on the library item. If the file is located in the same directory as the library storage backing folder, the server will move the file instead of copying it, thereby allowing instantaneous import of files for efficient backup and restore scenarios. In all other cases, a copy is performed rather than a move.

Parameters:

  • update_session_id

    Identifier of the update session to be modified.

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

    the optional parameters

Returns:



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

def add(update_session_id, request_body, opts = {})
  data, _status_code, _headers = add_with_http_info(update_session_id, request_body, opts)
  data
end

#add_with_http_info(update_session_id, request_body, opts = {}) ⇒ Array<(ContentLibraryItemUpdatesessionFileAddResult|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsUnauthorizedError|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.

Requests file content to be changed (either created, or updated). Depending on the source type of the file, this operation will either return an upload endpoint where the client can push the content, or the server will pull from the provided source endpoint. If a file with the same name already exists in this session, this operation will be used to update the content of the existing file. &lt;p&gt; When importing a file directly from storage, where the source endpoint is a file or datastore URI, you will need to have the ContentLibrary.ReadStorage privilege on the library item. If the file is located in the same directory as the library storage backing folder, the server will move the file instead of copying it, thereby allowing instantaneous import of files for efficient backup and restore scenarios. In all other cases, a copy is performed rather than a move.

Parameters:

  • update_session_id

    Identifier of the update session to be modified.

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

    the optional parameters

Returns:



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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 35

def add_with_http_info(update_session_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemUpdatesessionFileApi.add ...'
  end
  # verify the required parameter 'update_session_id' is set
  if @api_client.config.client_side_validation && update_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'update_session_id' when calling LibraryItemUpdatesessionFileApi.add"
  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 LibraryItemUpdatesessionFileApi.add"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=add'.sub('{' + 'update_session_id' + '}', update_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,
	:return_type => {
	  '200' => 'Content::ContentLibraryItemUpdatesessionFileAddResult',
	  '400' => 'Content::VapiStdErrorsNotAllowedInCurrentStateError',
	  '403' => 'Content::VapiStdErrorsUnauthorizedError',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemUpdatesessionFileApi#add\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get(update_session_id, request_body, opts = {}) ⇒ ContentLibraryItemUpdatesessionFileResult|VapiStdErrorsInvalidArgumentError|VapiStdErrorsNotFoundError|

Retrieves information about a specific file in the snapshot of the library item at the time when the update session was created.

Parameters:

  • update_session_id

    Identifier of the update session.

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

    the optional parameters

Returns:



88
89
90
91
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 88

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

#get_with_http_info(update_session_id, request_body, opts = {}) ⇒ Array<(ContentLibraryItemUpdatesessionFileResult|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.

Retrieves information about a specific file in the snapshot of the library item at the time when the update session was created.

Parameters:

  • update_session_id

    Identifier of the update session.

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

    the optional parameters

Returns:



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

def get_with_http_info(update_session_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemUpdatesessionFileApi.get ...'
  end
  # verify the required parameter 'update_session_id' is set
  if @api_client.config.client_side_validation && update_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'update_session_id' when calling LibraryItemUpdatesessionFileApi.get"
  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 LibraryItemUpdatesessionFileApi.get"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=get'.sub('{' + 'update_session_id' + '}', update_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,
	:return_type => {
	  '200' => 'Content::ContentLibraryItemUpdatesessionFileResult',
	  '400' => 'Content::VapiStdErrorsInvalidArgumentError',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemUpdatesessionFileApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list(update_session_id, opts = {}) ⇒ ContentLibraryItemUpdatesessionFileListResult|VapiStdErrorsNotFoundError|

Lists all files in the library item associated with the update session.

Parameters:

  • update_session_id

    Identifier of the update session.

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

    the optional parameters

Returns:



150
151
152
153
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 150

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

#list_with_http_info(update_session_id, opts = {}) ⇒ Array<(ContentLibraryItemUpdatesessionFileListResult|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 all files in the library item associated with the update session.

Parameters:

  • update_session_id

    Identifier of the update session.

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

    the optional parameters

Returns:



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 160

def list_with_http_info(update_session_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemUpdatesessionFileApi.list ...'
  end
  # verify the required parameter 'update_session_id' is set
  if @api_client.config.client_side_validation && update_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'update_session_id' when calling LibraryItemUpdatesessionFileApi.list"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/updatesession/file'

  # query parameters
  query_params = {}
  query_params[:'update_session_id'] = update_session_id

  # 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::ContentLibraryItemUpdatesessionFileListResult',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemUpdatesessionFileApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove(update_session_id, request_body, opts = {}) ⇒ |VapiStdErrorsInvalidArgumentError|VapiStdErrorsNotFoundError|nil

Requests a file to be removed. The file will only be effectively removed when the update session is completed.

Parameters:

  • update_session_id

    Identifier of the update session.

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

    the optional parameters

Returns:



206
207
208
209
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 206

def remove(update_session_id, request_body, opts = {})
  remove_with_http_info(update_session_id, request_body, opts)
  nil
end

#remove_with_http_info(update_session_id, request_body, opts = {}) ⇒ Array<(|VapiStdErrorsInvalidArgumentError|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.

Requests a file to be removed. The file will only be effectively removed when the update session is completed.

Parameters:

  • update_session_id

    Identifier of the update session.

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

    the optional parameters

Returns:



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

def remove_with_http_info(update_session_id, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemUpdatesessionFileApi.remove ...'
  end
  # verify the required parameter 'update_session_id' is set
  if @api_client.config.client_side_validation && update_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'update_session_id' when calling LibraryItemUpdatesessionFileApi.remove"
  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 LibraryItemUpdatesessionFileApi.remove"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=remove'.sub('{' + 'update_session_id' + '}', update_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: LibraryItemUpdatesessionFileApi#remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#validate(update_session_id, opts = {}) ⇒ ContentLibraryItemUpdatesessionFileValidateResult|VapiStdErrorsNotAllowedInCurrentStateError|VapiStdErrorsNotFoundError|

Validates the files in the update session with the referenced identifier and ensures all necessary files are received. In the case where a file is missing, this operation will return its name in the ValidationResult#missingFiles set. The user can add the missing files and try re-validating. For other type of errors, ValidationResult#invalidFiles will contain the list of invalid files.

Parameters:

  • update_session_id

    Identifier of the update session to validate.

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

    the optional parameters

Returns:



263
264
265
266
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 263

def validate(update_session_id, opts = {})
  data, _status_code, _headers = validate_with_http_info(update_session_id, opts)
  data
end

#validate_with_http_info(update_session_id, opts = {}) ⇒ Array<(ContentLibraryItemUpdatesessionFileValidateResult|VapiStdErrorsNotAllowedInCurrentStateError|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.

Validates the files in the update session with the referenced identifier and ensures all necessary files are received. In the case where a file is missing, this operation will return its name in the ValidationResult#missingFiles set. The user can add the missing files and try re-validating. For other type of errors, ValidationResult#invalidFiles will contain the list of invalid files.

Parameters:

  • update_session_id

    Identifier of the update session to validate.

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

    the optional parameters

Returns:



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/vsphere-automation-content/api/library_item_updatesession_file_api.rb', line 273

def validate_with_http_info(update_session_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: LibraryItemUpdatesessionFileApi.validate ...'
  end
  # verify the required parameter 'update_session_id' is set
  if @api_client.config.client_side_validation && update_session_id.nil?
    fail ArgumentError, "Missing the required parameter 'update_session_id' when calling LibraryItemUpdatesessionFileApi.validate"
  end
  # resource path
  local_var_path = '/com/vmware/content/library/item/updatesession/file/id:{update_session_id}?~action=validate'.sub('{' + 'update_session_id' + '}', update_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,
	:return_type => {
	  '200' => 'Content::ContentLibraryItemUpdatesessionFileValidateResult',
	  '400' => 'Content::VapiStdErrorsNotAllowedInCurrentStateError',
	  '404' => 'Content::VapiStdErrorsNotFoundError',
	})
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: LibraryItemUpdatesessionFileApi#validate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end