Class: Azure::ARM::Web::Models::RecommendationRule

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/azure_mgmt_web/models/recommendation_rule.rb

Overview

Represents a recommendation rule that the recommendation engine can perform

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#action_nameString

string

Returns:

  • (String)

    Name of action that is recommended by this rule in



35
36
37
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 35

def action_name
  @action_name
end

#channelsChannels

Possible values include: ‘Notification’, ‘Api’, ‘Email’, ‘All’

Returns:

  • (Channels)

    List of available channels that this rule applies.



48
49
50
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 48

def channels
  @channels
end

#descriptionString

Returns Localized detailed description of the rule.

Returns:

  • (String)

    Localized detailed description of the rule



31
32
33
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 31

def description
  @description
end

#display_nameString

Returns UI friendly name of the rule.

Returns:

  • (String)

    UI friendly name of the rule



20
21
22
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 20

def display_name
  @display_name
end

#enabledInteger

or disabled.

Returns:

  • (Integer)

    On/off flag indicating the rule is currently enabled



39
40
41
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 39

def enabled
  @enabled
end

#levelNotificationLevel

this rule is. Possible values include: ‘Critical’, ‘Warning’, ‘Information’, ‘NonUrgentSuggestion’

Returns:



44
45
46
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 44

def level
  @level
end

#messageString

Returns Localized name of the rule (Good for UI).

Returns:

  • (String)

    Localized name of the rule (Good for UI)



23
24
25
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 23

def message
  @message
end

#nameString

Returns Unique name of the rule.

Returns:

  • (String)

    Unique name of the rule



17
18
19
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 17

def name
  @name
end

#recommendation_idString

object tied to the rule, if exists. If such an object doesn’t exist, it is set to null.

Returns:

  • (String)

    Recommendation ID of an associated recommendation



28
29
30
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 28

def recommendation_id
  @recommendation_id
end

#tagsArray<String>

contains.

Returns:

  • (Array<String>)

    An array of category tags that the rule



52
53
54
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 52

def tags
  @tags
end

Class Method Details

.deserialize_object(object) ⇒ RecommendationRule

Deserializes given Ruby Hash into Model object.

Parameters:

  • object (Hash)

    Ruby Hash object to deserialize.

Returns:



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 110

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

.serialize_object(object) ⇒ Hash

Serializes given Model object into Ruby Hash.

Parameters:

  • object

    Model object to serialize.

Returns:

  • (Hash)

    Serialized object in form of Ruby Hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 68

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

Instance Method Details

#validateObject

Validate the object. Throws ValidationError if validation fails.



57
58
59
60
61
# File 'lib/azure_mgmt_web/models/recommendation_rule.rb', line 57

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