# 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 JobErrorAction include MsRestAzure # @return [JobActionType] Gets or sets the job error action type. # Possible values include: 'Http', 'Https', 'StorageQueue', # 'ServiceBusQueue', 'ServiceBusTopic' attr_accessor :type # @return [HttpRequest] Gets or sets the http requests. attr_accessor :request # @return [StorageQueueMessage] Gets or sets the storage queue message. attr_accessor :queue_message # @return [ServiceBusQueueMessage] Gets or sets the service bus queue # message. attr_accessor :service_bus_queue_message # @return [ServiceBusTopicMessage] Gets or sets the service bus topic # message. attr_accessor :service_bus_topic_message # @return [RetryPolicy] Gets or sets the retry policy. attr_accessor :retry_policy # # Validate the object. Throws ValidationError if validation fails. # def validate @request.validate unless @request.nil? @queue_message.validate unless @queue_message.nil? @service_bus_queue_message.validate unless @service_bus_queue_message.nil? @service_bus_topic_message.validate unless @service_bus_topic_message.nil? @retry_policy.validate unless @retry_policy.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.type output_object['type'] = serialized_property unless serialized_property.nil? serialized_property = object.request unless serialized_property.nil? serialized_property = HttpRequest.serialize_object(serialized_property) end output_object['request'] = serialized_property unless serialized_property.nil? serialized_property = object.queue_message unless serialized_property.nil? serialized_property = StorageQueueMessage.serialize_object(serialized_property) end output_object['queueMessage'] = serialized_property unless serialized_property.nil? serialized_property = object.service_bus_queue_message unless serialized_property.nil? serialized_property = ServiceBusQueueMessage.serialize_object(serialized_property) end output_object['serviceBusQueueMessage'] = serialized_property unless serialized_property.nil? serialized_property = object.service_bus_topic_message unless serialized_property.nil? serialized_property = ServiceBusTopicMessage.serialize_object(serialized_property) end output_object['serviceBusTopicMessage'] = serialized_property unless serialized_property.nil? serialized_property = object.retry_policy unless serialized_property.nil? serialized_property = RetryPolicy.serialize_object(serialized_property) end output_object['retryPolicy'] = 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 [JobErrorAction] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = JobErrorAction.new deserialized_property = object['type'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = JobActionType.constants.any? { |e| JobActionType.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum JobActionType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.type = deserialized_property deserialized_property = object['request'] unless deserialized_property.nil? deserialized_property = HttpRequest.deserialize_object(deserialized_property) end output_object.request = deserialized_property deserialized_property = object['queueMessage'] unless deserialized_property.nil? deserialized_property = StorageQueueMessage.deserialize_object(deserialized_property) end output_object.queue_message = deserialized_property deserialized_property = object['serviceBusQueueMessage'] unless deserialized_property.nil? deserialized_property = ServiceBusQueueMessage.deserialize_object(deserialized_property) end output_object.service_bus_queue_message = deserialized_property deserialized_property = object['serviceBusTopicMessage'] unless deserialized_property.nil? deserialized_property = ServiceBusTopicMessage.deserialize_object(deserialized_property) end output_object.service_bus_topic_message = deserialized_property deserialized_property = object['retryPolicy'] unless deserialized_property.nil? deserialized_property = RetryPolicy.deserialize_object(deserialized_property) end output_object.retry_policy = deserialized_property output_object end end end end