# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::SQL::Mgmt::V2017_03_01_preview
  module Models
    #
    # An execution of a job
    #
    class JobExecution < ProxyResource

      include MsRestAzure

      # @return [Integer] The job version number.
      attr_accessor :job_version

      # @return [String] The job step name.
      attr_accessor :step_name

      # @return [Integer] The job step id.
      attr_accessor :step_id

      # @return The unique identifier of the job execution.
      attr_accessor :job_execution_id

      # @return [JobExecutionLifecycle] The detailed state of the job
      # execution. Possible values include: 'Created', 'InProgress',
      # 'WaitingForChildJobExecutions', 'WaitingForRetry', 'Succeeded',
      # 'SucceededWithSkipped', 'Failed', 'TimedOut', 'Canceled', 'Skipped'
      attr_accessor :lifecycle

      # @return [ProvisioningState] The ARM provisioning state of the job
      # execution. Possible values include: 'Created', 'InProgress',
      # 'Succeeded', 'Failed', 'Canceled'
      attr_accessor :provisioning_state

      # @return [DateTime] The time that the job execution was created.
      attr_accessor :create_time

      # @return [DateTime] The time that the job execution started.
      attr_accessor :start_time

      # @return [DateTime] The time that the job execution completed.
      attr_accessor :end_time

      # @return [Integer] Number of times the job execution has been attempted.
      attr_accessor :current_attempts

      # @return [DateTime] Start time of the current attempt.
      attr_accessor :current_attempt_start_time

      # @return [String] The last status or error message.
      attr_accessor :last_message

      # @return [JobExecutionTarget] The target that this execution is executed
      # on.
      attr_accessor :target


      #
      # Mapper for JobExecution class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'JobExecution',
          type: {
            name: 'Composite',
            class_name: 'JobExecution',
            model_properties: {
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'type',
                type: {
                  name: 'String'
                }
              },
              job_version: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.jobVersion',
                type: {
                  name: 'Number'
                }
              },
              step_name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.stepName',
                type: {
                  name: 'String'
                }
              },
              step_id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.stepId',
                type: {
                  name: 'Number'
                }
              },
              job_execution_id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.jobExecutionId',
                type: {
                  name: 'String'
                }
              },
              lifecycle: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.lifecycle',
                type: {
                  name: 'String'
                }
              },
              provisioning_state: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.provisioningState',
                type: {
                  name: 'String'
                }
              },
              create_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.createTime',
                type: {
                  name: 'DateTime'
                }
              },
              start_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.startTime',
                type: {
                  name: 'DateTime'
                }
              },
              end_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.endTime',
                type: {
                  name: 'DateTime'
                }
              },
              current_attempts: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.currentAttempts',
                type: {
                  name: 'Number'
                }
              },
              current_attempt_start_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.currentAttemptStartTime',
                type: {
                  name: 'DateTime'
                }
              },
              last_message: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.lastMessage',
                type: {
                  name: 'String'
                }
              },
              target: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.target',
                type: {
                  name: 'Composite',
                  class_name: 'JobExecutionTarget'
                }
              }
            }
          }
        }
      end
    end
  end
end
