# 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::Web module Models # # Represents a recommendation rule that the recommendation engine can # perform # class RecommendationRule include MsRestAzure # @return [String] Unique name of the rule attr_accessor :name # @return [String] UI friendly name of the rule attr_accessor :display_name # @return [String] Localized name of the rule (Good for UI) attr_accessor :message # @return [String] Recommendation ID of an associated recommendation # object tied to the rule, if exists. # If such an object doesn't exist, it is set to null. attr_accessor :recommendation_id # @return [String] Localized detailed description of the rule attr_accessor :description # @return [String] Name of action that is recommended by this rule in # string attr_accessor :action_name # @return [Integer] On/off flag indicating the rule is currently enabled # or disabled. attr_accessor :enabled # @return [NotificationLevel] Level of impact indicating how critical # this rule is. Possible values include: 'Critical', 'Warning', # 'Information', 'NonUrgentSuggestion' attr_accessor :level # @return [Channels] List of available channels that this rule applies. # Possible values include: 'Notification', 'Api', 'Email', 'All' attr_accessor :channels # @return [Array] An array of category tags that the rule # contains. attr_accessor :tags # # Validate the object. Throws ValidationError if validation fails. # def validate fail MsRest::ValidationError, 'property level is nil' if @level.nil? fail MsRest::ValidationError, 'property channels is nil' if @channels.nil? @tags.each{ |e| e.validate if e.respond_to?(:validate) } unless @tags.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.level output_object['level'] = serialized_property unless serialized_property.nil? serialized_property = object.channels output_object['channels'] = serialized_property unless serialized_property.nil? serialized_property = object.name output_object['name'] = serialized_property unless serialized_property.nil? serialized_property = object.display_name output_object['displayName'] = serialized_property unless serialized_property.nil? serialized_property = object.message output_object['message'] = serialized_property unless serialized_property.nil? serialized_property = object.recommendation_id output_object['recommendationId'] = serialized_property unless serialized_property.nil? serialized_property = object.description output_object['description'] = serialized_property unless serialized_property.nil? serialized_property = object.action_name output_object['actionName'] = serialized_property unless serialized_property.nil? serialized_property = object.enabled output_object['enabled'] = serialized_property unless serialized_property.nil? serialized_property = object.tags output_object['tags'] = 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 [RecommendationRule] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = RecommendationRule.new deserialized_property = object['level'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = NotificationLevel.constants.any? { |e| NotificationLevel.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum NotificationLevel does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.level = deserialized_property deserialized_property = object['channels'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = Channels.constants.any? { |e| Channels.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum Channels does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.channels = deserialized_property deserialized_property = object['name'] output_object.name = deserialized_property deserialized_property = object['displayName'] output_object.display_name = deserialized_property deserialized_property = object['message'] output_object.message = deserialized_property deserialized_property = object['recommendationId'] output_object.recommendation_id = deserialized_property deserialized_property = object['description'] output_object.description = deserialized_property deserialized_property = object['actionName'] output_object.action_name = deserialized_property deserialized_property = object['enabled'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.enabled = deserialized_property deserialized_property = object['tags'] output_object.tags = deserialized_property output_object end end end end