# 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 result generated by the recommendation engine # class Recommendation include MsRestAzure # @return [DateTime] Timestamp when this instance was created. attr_accessor :creation_time # @return [String] A GUID value that each recommendation object is # associated with. attr_accessor :recommendation_id # @return [String] Full ARM resource ID string that this recommendation # object is associated with. attr_accessor :resource_id # @return [String] Name of a resource type this recommendation applies, # e.g. Subscription, ServerFarm, Site. attr_accessor :resource_scope # @return [String] Unique name of the rule attr_accessor :rule_name # @return [String] UI friendly name of the rule (may not be unique) attr_accessor :display_name # @return [String] Localized text of recommendation, good for UI. attr_accessor :message # @return [NotificationLevel] Level indicating how critical this # recommendation can impact. Possible values include: 'Critical', # 'Warning', 'Information', 'NonUrgentSuggestion' attr_accessor :level # @return [Channels] List of channels that this recommendation can # apply. Possible values include: 'Notification', 'Api', 'Email', 'All' attr_accessor :channels # @return [Array] The list of category tags that this # recommendation belongs to. attr_accessor :tags # @return [String] Name of action recommended by this object. attr_accessor :action_name # @return [Integer] On/off flag indicating the rule is currently enabled # or disabled. attr_accessor :enabled # @return [DateTime] The beginning time of a range that the # recommendation refers to. attr_accessor :start_time # @return [DateTime] The end time of a range that the recommendation # refers to. attr_accessor :end_time # @return [DateTime] When to notify this recommendation next. Null means # that this will never be notified anymore. attr_accessor :next_notification_time # @return [DateTime] Date and time when this notification expires. attr_accessor :notification_expiration_time # @return [DateTime] Last timestamp this instance was actually notified. # Null means that this recommendation hasn't been notified yet. attr_accessor :notified_time # @return [Float] A metric value measured by the rule. attr_accessor :score # # 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.creation_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['creationTime'] = serialized_property unless serialized_property.nil? serialized_property = object.recommendation_id output_object['recommendationId'] = serialized_property unless serialized_property.nil? serialized_property = object.resource_id output_object['resourceId'] = serialized_property unless serialized_property.nil? serialized_property = object.resource_scope output_object['resourceScope'] = serialized_property unless serialized_property.nil? serialized_property = object.rule_name output_object['ruleName'] = 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.tags output_object['tags'] = 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.start_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['startTime'] = serialized_property unless serialized_property.nil? serialized_property = object.end_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['endTime'] = serialized_property unless serialized_property.nil? serialized_property = object.next_notification_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['nextNotificationTime'] = serialized_property unless serialized_property.nil? serialized_property = object.notification_expiration_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['notificationExpirationTime'] = serialized_property unless serialized_property.nil? serialized_property = object.notified_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['notifiedTime'] = serialized_property unless serialized_property.nil? serialized_property = object.score output_object['score'] = 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 [Recommendation] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = Recommendation.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['creationTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.creation_time = deserialized_property deserialized_property = object['recommendationId'] output_object.recommendation_id = deserialized_property deserialized_property = object['resourceId'] output_object.resource_id = deserialized_property deserialized_property = object['resourceScope'] output_object.resource_scope = deserialized_property deserialized_property = object['ruleName'] output_object.rule_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['tags'] output_object.tags = 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['startTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.start_time = deserialized_property deserialized_property = object['endTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.end_time = deserialized_property deserialized_property = object['nextNotificationTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.next_notification_time = deserialized_property deserialized_property = object['notificationExpirationTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.notification_expiration_time = deserialized_property deserialized_property = object['notifiedTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.notified_time = deserialized_property deserialized_property = object['score'] deserialized_property = Float(deserialized_property) unless deserialized_property.to_s.empty? output_object.score = deserialized_property output_object end end end end