class Apcera::Task

Attributes

errored[RW]
events[RW]
state[RW]
time_completed[RW]
time_started[RW]
uuid[RW]

Public Class Methods

attribute_map() click to toggle source

attribute mapping from ruby-style variable name to JSON key

# File lib/apcera/models/task.rb, line 6
def self.attribute_map
  {
    
    # Describes the error for a Task that has encountered an error.
    :'errored' => :'errored',
    
    # List of all TaskEvents that have been published for this particular task.
    :'events' => :'events',
    
    # The Task's current state. Can be `running`, `stopped` or `complete`.
    :'state' => :'state',
    
    # Indicates the time when the task completed. Stored as a UNIX timestamp with nanosecond precision.
    :'time_completed' => :'time_completed',
    
    # Indicates the time when the task was started. Stored as a UNIX timestamp with nanosecond precision.
    :'time_started' => :'time_started',
    
    # The task's unique identifier.
    :'uuid' => :'uuid'
    
  }
end
new(attributes = {}) click to toggle source
# File lib/apcera/models/task.rb, line 43
def initialize(attributes = {})
  return if !attributes.is_a?(Hash) || attributes.empty?

  # convert string to symbol for hash key
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}

  
  if attributes[:'errored']
    self.errored = attributes[:'errored']
  end
  
  if attributes[:'events']
    if (value = attributes[:'events']).is_a?(Array)
      self.events = value
    end
  end
  
  if attributes[:'state']
    self.state = attributes[:'state']
  end
  
  if attributes[:'time_completed']
    self.time_completed = attributes[:'time_completed']
  end
  
  if attributes[:'time_started']
    self.time_started = attributes[:'time_started']
  end
  
  if attributes[:'uuid']
    self.uuid = attributes[:'uuid']
  end
  
end
swagger_types() click to toggle source

attribute type

# File lib/apcera/models/task.rb, line 31
def self.swagger_types
  {
    :'errored' => :'String',
    :'events' => :'Array<TaskEvent>',
    :'state' => :'String',
    :'time_completed' => :'Integer',
    :'time_started' => :'Integer',
    :'uuid' => :'String'
    
  }
end

Public Instance Methods

state=(state) click to toggle source
# File lib/apcera/models/task.rb, line 78
def state=(state)
  allowed_values = ["running", "stopped", "complete"]
  if state && !allowed_values.include?(state)
    fail "invalid value for 'state', must be one of #{allowed_values}"
  end
  @state = state
end