Class: TaskStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/secured_cloud_api_client/task_status.rb

Overview

Status of asynchronous tasks in Secured Cloud.

@author

Alan Vella

Instance Method Summary collapse

Constructor Details

#initialize(percentageComplete, requestStateEnum, result, errorCode, errorMessage, latestTaskDescription, processDescription, createdTimestamp, lastUpdatedTimeStamp) ⇒ TaskStatus

Returns a new instance of TaskStatus.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/secured_cloud_api_client/task_status.rb', line 11

def initialize(percentageComplete, requestStateEnum, result, errorCode, errorMessage, latestTaskDescription, processDescription, createdTimestamp, lastUpdatedTimeStamp)
  @percentageComplete = percentageComplete
  @requestStateEnum = requestStateEnum
  @result = result
  @errorCode = errorCode
  @errorMessage = errorMessage
  @latestTaskDescription = latestTaskDescription
  @processDescription = processDescription
  @createdTimestamp = createdTimestamp
  @lastUpdatedTimeStamp = lastUpdatedTimeStamp
  
  #Handle bum messages
  if (@errorMessage == "DC VCPU Allocation not defined for VDC: %s") then
    @errorMessage = "VCPU Allocation not defined for this node"
  elsif (@errorMessage == "VDC Memory Allocation not defined for VDC: %s") then
    @errorMessage = "Memory Allocation not defined for this node"
  elsif (@errorMessage == "VDC Storage Allocation not defined for VDC: %s") then
    @errorMessage = "Storage Allocation not defined for this node"
  end
  
end

Instance Method Details

#get_detailsObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/secured_cloud_api_client/task_status.rb', line 34

def get_details()
  details  = "Percentage Complete    : #{@percentageComplete}\n"
  details += "Request State          : #{@requestStateEnum}\n"
  details += "Result                 : #{@result}\n"
  details += "Error Code             : #{@errorCode}\n"
  details += "Error Message          : #{@errorMessage}\n"
  details += "Latest Task Description: #{@latestTaskDescription}\n"
  details += "Process Description    : #{@processDescription}\n"
  details += "Created Timestamp      : #{@createdTimestamp}\n"
  details += "Last Updated Timestamp : #{@lastUpdatedTimeStamp}\n"
  return details
end

#get_error_codeObject



52
53
54
# File 'lib/secured_cloud_api_client/task_status.rb', line 52

def get_error_code
	return @errorCode
end

#get_error_messageObject



57
58
59
# File 'lib/secured_cloud_api_client/task_status.rb', line 57

def get_error_message
	return @errorMessage
end

#get_latest_task_descriptionObject



67
68
69
# File 'lib/secured_cloud_api_client/task_status.rb', line 67

def get_latest_task_description
  return @latestTaskDescription
end

#get_percentage_completedObject



62
63
64
# File 'lib/secured_cloud_api_client/task_status.rb', line 62

def get_percentage_completed
  return @percentageComplete
end

#get_resultObject



48
49
50
# File 'lib/secured_cloud_api_client/task_status.rb', line 48

def get_result
  return (@result.nil?) ? nil : @result["resourceURL"]
end