# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.17.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 ServiceBusMessage include MsRestAzure # @return [ServiceBusAuthentication] Gets or sets the authentication. attr_accessor :authentication # @return [ServiceBusBrokeredMessageProperties] Gets or sets the # brokered message properties. attr_accessor :brokered_message_properties # @return [Hash{String => String}] Gets or sets the custom message # properties. attr_accessor :custom_message_properties # @return [String] Gets or sets the message. attr_accessor :message # @return [String] Gets or sets the namespace. attr_accessor :namespace # @return [ServiceBusTransportType] Gets or sets the transport type. # Possible values include: 'NotSpecified', 'NetMessaging', 'AMQP' attr_accessor :transport_type # # Validate the object. Throws ValidationError if validation fails. # def validate @authentication.validate unless @authentication.nil? @brokered_message_properties.validate unless @brokered_message_properties.nil? @custom_message_properties.each{ |e| e.validate if e.respond_to?(:validate) } unless @custom_message_properties.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.authentication unless serialized_property.nil? serialized_property = ServiceBusAuthentication.serialize_object(serialized_property) end output_object['authentication'] = serialized_property unless serialized_property.nil? serialized_property = object.brokered_message_properties unless serialized_property.nil? serialized_property = ServiceBusBrokeredMessageProperties.serialize_object(serialized_property) end output_object['brokeredMessageProperties'] = serialized_property unless serialized_property.nil? serialized_property = object.custom_message_properties output_object['customMessageProperties'] = serialized_property unless serialized_property.nil? serialized_property = object.message output_object['message'] = serialized_property unless serialized_property.nil? serialized_property = object.namespace output_object['namespace'] = serialized_property unless serialized_property.nil? serialized_property = object.transport_type output_object['transportType'] = 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 [ServiceBusMessage] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = ServiceBusMessage.new deserialized_property = object['authentication'] unless deserialized_property.nil? deserialized_property = ServiceBusAuthentication.deserialize_object(deserialized_property) end output_object.authentication = deserialized_property deserialized_property = object['brokeredMessageProperties'] unless deserialized_property.nil? deserialized_property = ServiceBusBrokeredMessageProperties.deserialize_object(deserialized_property) end output_object.brokered_message_properties = deserialized_property deserialized_property = object['customMessageProperties'] output_object.custom_message_properties = deserialized_property deserialized_property = object['message'] output_object.message = deserialized_property deserialized_property = object['namespace'] output_object.namespace = deserialized_property deserialized_property = object['transportType'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = ServiceBusTransportType.constants.any? { |e| ServiceBusTransportType.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum ServiceBusTransportType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.transport_type = deserialized_property output_object end end end end