class VSphereAutomation::VCenter::VmPowerApi
Attributes
Public Class Methods
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 16 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Returns the power state information of a virtual machine. @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [VcenterVmPowerResult|VapiStdErrorsResourceInaccessibleError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|]
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 23 def get(vm, opts = {}) data, _status_code, _headers = get_with_http_info(vm, opts) data end
Returns the power state information of a virtual machine. @api private @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [Array<(VcenterVmPowerResult|VapiStdErrorsResourceInaccessibleError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|, Fixnum, Hash)>] data, response status code and response headers
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 33 def get_with_http_info(vm, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VmPowerApi.get ...' end # verify the required parameter 'vm' is set if @api_client.config.client_side_validation && vm.nil? fail ArgumentError, "Missing the required parameter 'vm' when calling VmPowerApi.get" end # resource path local_var_path = '/vcenter/vm/{vm}/power'.sub('{' + 'vm' + '}', vm.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::VcenterVmPowerResult', '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: VmPowerApi#get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Resets a powered-on virtual machine. @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil]
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 81 def reset(vm, opts = {}) reset_with_http_info(vm, opts) nil end
Resets a powered-on virtual machine. @api private @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [Array<(|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 91 def reset_with_http_info(vm, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VmPowerApi.reset ...' end # verify the required parameter 'vm' is set if @api_client.config.client_side_validation && vm.nil? fail ArgumentError, "Missing the required parameter 'vm' when calling VmPowerApi.reset" end # resource path local_var_path = '/vcenter/vm/{vm}/power/reset'.sub('{' + 'vm' + '}', vm.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: VmPowerApi#reset\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Powers on a powered-off or suspended virtual machine. @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil]
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 131 def start(vm, opts = {}) start_with_http_info(vm, opts) nil end
Powers on a powered-off or suspended virtual machine. @api private @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [Array<(|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 141 def start_with_http_info(vm, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VmPowerApi.start ...' end # verify the required parameter 'vm' is set if @api_client.config.client_side_validation && vm.nil? fail ArgumentError, "Missing the required parameter 'vm' when calling VmPowerApi.start" end # resource path local_var_path = '/vcenter/vm/{vm}/power/start'.sub('{' + 'vm' + '}', vm.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: VmPowerApi#start\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Powers off a powered-on or suspended virtual machine. @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil]
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 181 def stop(vm, opts = {}) stop_with_http_info(vm, opts) nil end
Powers off a powered-on or suspended virtual machine. @api private @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [Array<(|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 191 def stop_with_http_info(vm, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VmPowerApi.stop ...' end # verify the required parameter 'vm' is set if @api_client.config.client_side_validation && vm.nil? fail ArgumentError, "Missing the required parameter 'vm' when calling VmPowerApi.stop" end # resource path local_var_path = '/vcenter/vm/{vm}/power/stop'.sub('{' + 'vm' + '}', vm.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: VmPowerApi#stop\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Suspends a powered-on virtual machine. @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil]
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 231 def suspend(vm, opts = {}) suspend_with_http_info(vm, opts) nil end
Suspends a powered-on virtual machine. @api private @param vm Virtual machine identifier. The parameter must be an identifier for the resource type: VirtualMachine. @param [Hash] opts the optional parameters @return [Array<(|VapiStdErrorsResourceBusyError|VapiStdErrorsUnauthenticatedError|VapiStdErrorsUnauthorizedError|VapiStdErrorsNotFoundError|VapiStdErrorsServiceUnavailableError|nil, Fixnum, Hash)>] nil, response status code and response headers
# File lib/vsphere-automation-vcenter/api/vm_power_api.rb, line 241 def suspend_with_http_info(vm, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: VmPowerApi.suspend ...' end # verify the required parameter 'vm' is set if @api_client.config.client_side_validation && vm.nil? fail ArgumentError, "Missing the required parameter 'vm' when calling VmPowerApi.suspend" end # resource path local_var_path = '/vcenter/vm/{vm}/power/suspend'.sub('{' + 'vm' + '}', vm.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: VmPowerApi#suspend\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end