# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Scheduler module Models # # Model object. # class JobProperties include MsRestAzure # @return [DateTime] Gets or sets the job start time. attr_accessor :start_time # @return [JobAction] Gets or sets the job action. attr_accessor :action # @return [JobRecurrence] Gets or sets the job recurrence. attr_accessor :recurrence # @return [JobState] Gets or set the job state. Possible values include: # 'Enabled', 'Disabled', 'Faulted', 'Completed' attr_accessor :state # @return [JobStatus] Gets the job status. attr_accessor :status # # Validate the object. Throws ValidationError if validation fails. # def validate @action.validate unless @action.nil? @recurrence.validate unless @recurrence.nil? @status.validate unless @status.nil? end # # Serializes given Model object into Ruby Hash. # @param object Model object to serialize. # @return [Hash] Serialized object in form of Ruby Hash. # def self.serialize_object(object) object.validate output_object = {} serialized_property = object.start_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['startTime'] = serialized_property unless serialized_property.nil? serialized_property = object.action unless serialized_property.nil? serialized_property = JobAction.serialize_object(serialized_property) end output_object['action'] = serialized_property unless serialized_property.nil? serialized_property = object.recurrence unless serialized_property.nil? serialized_property = JobRecurrence.serialize_object(serialized_property) end output_object['recurrence'] = serialized_property unless serialized_property.nil? serialized_property = object.state output_object['state'] = serialized_property unless serialized_property.nil? serialized_property = object.status unless serialized_property.nil? serialized_property = JobStatus.serialize_object(serialized_property) end output_object['status'] = serialized_property unless serialized_property.nil? output_object end # # Deserializes given Ruby Hash into Model object. # @param object [Hash] Ruby Hash object to deserialize. # @return [JobProperties] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = JobProperties.new deserialized_property = object['startTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.start_time = deserialized_property deserialized_property = object['action'] unless deserialized_property.nil? deserialized_property = JobAction.deserialize_object(deserialized_property) end output_object.action = deserialized_property deserialized_property = object['recurrence'] unless deserialized_property.nil? deserialized_property = JobRecurrence.deserialize_object(deserialized_property) end output_object.recurrence = deserialized_property deserialized_property = object['state'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = JobState.constants.any? { |e| JobState.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum JobState does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.state = deserialized_property deserialized_property = object['status'] unless deserialized_property.nil? deserialized_property = JobStatus.deserialize_object(deserialized_property) end output_object.status = deserialized_property output_object end end end end