class VSphereAutomation::VCenter::VmTemplateLibraryItemsApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 16
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create(request_body, opts = {}) click to toggle source

Creates a library item in content library from a virtual machine. This {@term operation} creates a library item in content library whose content is a virtual machine template created from the source virtual machine, using the supplied create specification. The virtual machine template is stored in a newly created library item. @param request_body @param [Hash] opts the optional parameters @return [VcenterVmTemplateLibraryItemsCreateResult|VapiStdErrorsUnableToAllocateResourceError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|]

# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 23
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 = {}) click to toggle source

Creates a library item in content library from a virtual machine. This {@term operation} creates a library item in content library whose content is a virtual machine template created from the source virtual machine, using the supplied create specification. The virtual machine template is stored in a newly created library item. @api private @param request_body @param [Hash] opts the optional parameters @return [Array<(VcenterVmTemplateLibraryItemsCreateResult|VapiStdErrorsUnableToAllocateResourceError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|, Fixnum, Hash)>] data, response status code and response headers

# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 33
def create_with_http_info(request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VmTemplateLibraryItemsApi.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 VmTemplateLibraryItemsApi.create"
  end
  # resource path
  local_var_path = '/vcenter/vm-template/library-items'

  # 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' => 'VCenter::VcenterVmTemplateLibraryItemsCreateResult',
      '400' => 'VCenter::VapiStdErrorsUnableToAllocateResourceError',
      '401' => 'VCenter::VapiStdErrorsUnauthenticatedError',
      '403' => 'VCenter::VapiStdErrorsUnauthorizedError',
      '404' => 'VCenter::VapiStdErrorsNotFoundError',
      '503' => 'VCenter::VapiStdErrorsServiceUnavailableError',
    })
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VmTemplateLibraryItemsApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
deploy(template_library_item, request_body, opts = {}) click to toggle source

Deploys a virtual machine as a copy of the source virtual machine template contained in the library item specified by {@param.name templateLibraryItem}. It uses the deployment specification in {@param.name spec}. If {@link DeploySpec#poweredOn} and/or {@link DeploySpec#guestCustomization} are specified, the server triggers the power on and/or guest customization operations, which are executed asynchronously. @param template_library_item identifier of the content library item containing the source virtual machine template to be deployed. @param request_body @param [Hash] opts the optional parameters @return [VcenterVmTemplateLibraryItemsDeployResult|VapiStdErrorsUnableToAllocateResourceError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|]

# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 84
def deploy(template_library_item, request_body, opts = {})
  data, _status_code, _headers = deploy_with_http_info(template_library_item, request_body, opts)
  data
end
deploy_with_http_info(template_library_item, request_body, opts = {}) click to toggle source

Deploys a virtual machine as a copy of the source virtual machine template contained in the library item specified by {@param.name templateLibraryItem}. It uses the deployment specification in {@param.name spec}. If {@link DeploySpec#poweredOn} and/or {@link DeploySpec#guestCustomization} are specified, the server triggers the power on and/or guest customization operations, which are executed asynchronously. @api private @param template_library_item identifier of the content library item containing the source virtual machine template to be deployed. @param request_body @param [Hash] opts the optional parameters @return [Array<(VcenterVmTemplateLibraryItemsDeployResult|VapiStdErrorsUnableToAllocateResourceError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|, Fixnum, Hash)>] data, response status code and response headers

# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 95
def deploy_with_http_info(template_library_item, request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VmTemplateLibraryItemsApi.deploy ...'
  end
  # verify the required parameter 'template_library_item' is set
  if @api_client.config.client_side_validation && template_library_item.nil?
    fail ArgumentError, "Missing the required parameter 'template_library_item' when calling VmTemplateLibraryItemsApi.deploy"
  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 VmTemplateLibraryItemsApi.deploy"
  end
  # resource path
  local_var_path = '/vcenter/vm-template/library-items/{template_library_item}?action=deploy'.sub('{' + 'template_library_item' + '}', template_library_item.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' => 'VCenter::VcenterVmTemplateLibraryItemsDeployResult',
      '400' => 'VCenter::VapiStdErrorsUnableToAllocateResourceError',
      '401' => 'VCenter::VapiStdErrorsUnauthenticatedError',
      '403' => 'VCenter::VapiStdErrorsUnauthorizedError',
      '404' => 'VCenter::VapiStdErrorsNotFoundError',
      '503' => 'VCenter::VapiStdErrorsServiceUnavailableError',
    })
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VmTemplateLibraryItemsApi#deploy\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get(template_library_item, opts = {}) click to toggle source

Returns information about a virtual machine template contained in the library item specified by {@param.name templateLibraryItem} @param template_library_item identifier of the library item containing the virtual machine template. @param [Hash] opts the optional parameters @return [VcenterVmTemplateLibraryItemsResult|VapiStdErrorsResourceInaccessibleError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|]

# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 149
def get(template_library_item, opts = {})
  data, _status_code, _headers = get_with_http_info(template_library_item, opts)
  data
end
get_with_http_info(template_library_item, opts = {}) click to toggle source

Returns information about a virtual machine template contained in the library item specified by {@param.name templateLibraryItem} @api private @param template_library_item identifier of the library item containing the virtual machine template. @param [Hash] opts the optional parameters @return [Array<(VcenterVmTemplateLibraryItemsResult|VapiStdErrorsResourceInaccessibleError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|, Fixnum, Hash)>] data, response status code and response headers

# File lib/vsphere-automation-vcenter/api/vm_template_library_items_api.rb, line 159
def get_with_http_info(template_library_item, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: VmTemplateLibraryItemsApi.get ...'
  end
  # verify the required parameter 'template_library_item' is set
  if @api_client.config.client_side_validation && template_library_item.nil?
    fail ArgumentError, "Missing the required parameter 'template_library_item' when calling VmTemplateLibraryItemsApi.get"
  end
  # resource path
  local_var_path = '/vcenter/vm-template/library-items/{template_library_item}'.sub('{' + 'template_library_item' + '}', template_library_item.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' => 'VCenter::VcenterVmTemplateLibraryItemsResult',
      '400' => 'VCenter::VapiStdErrorsResourceInaccessibleError',
      '401' => 'VCenter::VapiStdErrorsUnauthenticatedError',
      '403' => 'VCenter::VapiStdErrorsUnauthorizedError',
      '404' => 'VCenter::VapiStdErrorsNotFoundError',
      '503' => 'VCenter::VapiStdErrorsServiceUnavailableError',
    })
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: VmTemplateLibraryItemsApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end