Class: Azure::ARM::Web::Models::Recommendation

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

Overview

Represents a recommendation result generated by the recommendation engine

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#action_nameString



53
54
55
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 53

def action_name
  @action_name
end

#channelsChannels

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



46
47
48
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 46

def channels
  @channels
end

#creation_timeDateTime



16
17
18
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 16

def creation_time
  @creation_time
end

#display_nameString



34
35
36
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 34

def display_name
  @display_name
end

#enabledInteger

or disabled.



57
58
59
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 57

def enabled
  @enabled
end

#end_timeDateTime

refers to.



65
66
67
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 65

def end_time
  @end_time
end

#levelNotificationLevel

recommendation can impact. Possible values include: ‘Critical’, ‘Warning’, ‘Information’, ‘NonUrgentSuggestion’



42
43
44
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 42

def level
  @level
end

#messageString



37
38
39
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 37

def message
  @message
end

#next_notification_timeDateTime

that this will never be notified anymore.



69
70
71
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 69

def next_notification_time
  @next_notification_time
end

#notification_expiration_timeDateTime



72
73
74
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 72

def notification_expiration_time
  @notification_expiration_time
end

#notified_timeDateTime

Null means that this recommendation hasn’t been notified yet.



76
77
78
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 76

def notified_time
  @notified_time
end

#recommendation_idString

associated with.



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

def recommendation_id
  @recommendation_id
end

#resource_idString

object is associated with.



24
25
26
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 24

def resource_id
  @resource_id
end

#resource_scopeString

e.g. Subscription, ServerFarm, Site.



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

def resource_scope
  @resource_scope
end

#rule_nameString



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

def rule_name
  @rule_name
end

#scoreFloat



79
80
81
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 79

def score
  @score
end

#start_timeDateTime

recommendation refers to.



61
62
63
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 61

def start_time
  @start_time
end

#tagsArray<String>

recommendation belongs to.



50
51
52
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 50

def tags
  @tags
end

Class Method Details

.deserialize_object(object) ⇒ Recommendation

Deserializes given Ruby Hash into Model object.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 167

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

.serialize_object(object) ⇒ Hash

Serializes given Model object into Ruby Hash.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
155
156
157
158
159
160
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 95

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

Instance Method Details

#validateObject

Validate the object. Throws ValidationError if validation fails.



84
85
86
87
88
# File 'lib/azure_mgmt_web/models/recommendation.rb', line 84

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