Class: Appwrite::Models::Alert

Inherits:
Object
  • Object
show all
Defined in:
lib/appwrite/models/alert.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, monitor_id:, project_id:, name:, status:, resolved_at: nil, acknowledged_at: nil, acknowledged_by:, acknowledged_by_name:, escalation_id:, escalation_step:, escalation_round:, escalates_at: nil, rules:, severity:, metric: nil, comparator: nil, threshold:, value:, peak:, type:, resource_type:, resource_id:, notifications:, latency: nil, result: nil) ⇒ Alert

Returns a new instance of Alert.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
# File 'lib/appwrite/models/alert.rb', line 35

def initialize(
    id:,
    created_at:,
    updated_at:,
    monitor_id:,
    project_id:,
    name:,
    status:,
    resolved_at: nil,
    acknowledged_at: nil,
    acknowledged_by:,
    acknowledged_by_name:,
    escalation_id:,
    escalation_step:,
    escalation_round:,
    escalates_at: nil,
    rules:,
    severity:,
    metric: nil,
    comparator: nil,
    threshold:,
    value:,
    peak:,
    type:,
    resource_type:,
    resource_id:,
    notifications:,
    latency: nil,
    result: nil
)
    @id = id
    @created_at = created_at
    @updated_at = updated_at
    @monitor_id = monitor_id
    @project_id = project_id
    @name = name
    @status = validate_status(status)
    @resolved_at = resolved_at
    @acknowledged_at = acknowledged_at
    @acknowledged_by = acknowledged_by
    @acknowledged_by_name = acknowledged_by_name
    @escalation_id = escalation_id
    @escalation_step = escalation_step
    @escalation_round = escalation_round
    @escalates_at = escalates_at
    @rules = rules
    @severity = validate_severity(severity)
    @metric = metric.nil? ? metric : validate_metric(metric)
    @comparator = comparator.nil? ? comparator : validate_comparator(comparator)
    @threshold = threshold
    @value = value
    @peak = peak
    @type = validate_type(type)
    @resource_type = validate_resource_type(resource_type)
    @resource_id = resource_id
    @notifications = notifications
    @latency = latency
    @result = result.nil? ? result : validate_result(result)
end

Instance Attribute Details

#acknowledged_at ⇒ Object (readonly)

Returns the value of attribute acknowledged_at.



14
15
16
# File 'lib/appwrite/models/alert.rb', line 14

def acknowledged_at
  @acknowledged_at
end

#acknowledged_by ⇒ Object (readonly)

Returns the value of attribute acknowledged_by.



15
16
17
# File 'lib/appwrite/models/alert.rb', line 15

def acknowledged_by
  @acknowledged_by
end

#acknowledged_by_name ⇒ Object (readonly)

Returns the value of attribute acknowledged_by_name.



16
17
18
# File 'lib/appwrite/models/alert.rb', line 16

def acknowledged_by_name
  @acknowledged_by_name
end

#comparator ⇒ Object (readonly)

Returns the value of attribute comparator.



24
25
26
# File 'lib/appwrite/models/alert.rb', line 24

def comparator
  @comparator
end

#created_at ⇒ Object (readonly)

Returns the value of attribute created_at.



7
8
9
# File 'lib/appwrite/models/alert.rb', line 7

def created_at
  @created_at
end

#escalates_at ⇒ Object (readonly)

Returns the value of attribute escalates_at.



20
21
22
# File 'lib/appwrite/models/alert.rb', line 20

def escalates_at
  @escalates_at
end

#escalation_id ⇒ Object (readonly)

Returns the value of attribute escalation_id.



17
18
19
# File 'lib/appwrite/models/alert.rb', line 17

def escalation_id
  @escalation_id
end

#escalation_round ⇒ Object (readonly)

Returns the value of attribute escalation_round.



19
20
21
# File 'lib/appwrite/models/alert.rb', line 19

def escalation_round
  @escalation_round
end

#escalation_step ⇒ Object (readonly)

Returns the value of attribute escalation_step.



18
19
20
# File 'lib/appwrite/models/alert.rb', line 18

def escalation_step
  @escalation_step
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/appwrite/models/alert.rb', line 6

def id
  @id
end

#latency ⇒ Object (readonly)

Returns the value of attribute latency.



32
33
34
# File 'lib/appwrite/models/alert.rb', line 32

def latency
  @latency
end

#metric ⇒ Object (readonly)

Returns the value of attribute metric.



23
24
25
# File 'lib/appwrite/models/alert.rb', line 23

def metric
  @metric
end

#monitor_id ⇒ Object (readonly)

Returns the value of attribute monitor_id.



9
10
11
# File 'lib/appwrite/models/alert.rb', line 9

def monitor_id
  @monitor_id
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/appwrite/models/alert.rb', line 11

def name
  @name
end

#notifications ⇒ Object (readonly)

Returns the value of attribute notifications.



31
32
33
# File 'lib/appwrite/models/alert.rb', line 31

def notifications
  @notifications
end

#peak ⇒ Object (readonly)

Returns the value of attribute peak.



27
28
29
# File 'lib/appwrite/models/alert.rb', line 27

def peak
  @peak
end

#project_id ⇒ Object (readonly)

Returns the value of attribute project_id.



10
11
12
# File 'lib/appwrite/models/alert.rb', line 10

def project_id
  @project_id
end

#resolved_at ⇒ Object (readonly)

Returns the value of attribute resolved_at.



13
14
15
# File 'lib/appwrite/models/alert.rb', line 13

def resolved_at
  @resolved_at
end

#resource_id ⇒ Object (readonly)

Returns the value of attribute resource_id.



30
31
32
# File 'lib/appwrite/models/alert.rb', line 30

def resource_id
  @resource_id
end

#resource_type ⇒ Object (readonly)

Returns the value of attribute resource_type.



29
30
31
# File 'lib/appwrite/models/alert.rb', line 29

def resource_type
  @resource_type
end

#result ⇒ Object (readonly)

Returns the value of attribute result.



33
34
35
# File 'lib/appwrite/models/alert.rb', line 33

def result
  @result
end

#rules ⇒ Object (readonly)

Returns the value of attribute rules.



21
22
23
# File 'lib/appwrite/models/alert.rb', line 21

def rules
  @rules
end

#severity ⇒ Object (readonly)

Returns the value of attribute severity.



22
23
24
# File 'lib/appwrite/models/alert.rb', line 22

def severity
  @severity
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/appwrite/models/alert.rb', line 12

def status
  @status
end

#threshold ⇒ Object (readonly)

Returns the value of attribute threshold.



25
26
27
# File 'lib/appwrite/models/alert.rb', line 25

def threshold
  @threshold
end

#type ⇒ Object (readonly)

Returns the value of attribute type.



28
29
30
# File 'lib/appwrite/models/alert.rb', line 28

def type
  @type
end

#updated_at ⇒ Object (readonly)

Returns the value of attribute updated_at.



8
9
10
# File 'lib/appwrite/models/alert.rb', line 8

def updated_at
  @updated_at
end

#value ⇒ Object (readonly)

Returns the value of attribute value.



26
27
28
# File 'lib/appwrite/models/alert.rb', line 26

def value
  @value
end

Class Method Details

.from(map:) ⇒ Object



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
# File 'lib/appwrite/models/alert.rb', line 95

def self.from(map:)
    map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "monitorId" => "", "projectId" => "", "name" => "", "status" => "firing", "acknowledgedBy" => "", "acknowledgedByName" => "", "escalationId" => "", "escalationStep" => 0, "escalationRound" => 0, "rules" => [], "severity" => "warning", "threshold" => 0, "value" => 0, "peak" => 0, "type" => "usage", "resourceType" => "project", "resourceId" => "", "notifications" => 0 }.merge(map)
    Alert.new(
        id: map["$id"],
        created_at: map["$createdAt"],
        updated_at: map["$updatedAt"],
        monitor_id: map["monitorId"],
        project_id: map["projectId"],
        name: map["name"],
        status: map["status"],
        resolved_at: map["resolvedAt"],
        acknowledged_at: map["acknowledgedAt"],
        acknowledged_by: map["acknowledgedBy"],
        acknowledged_by_name: map["acknowledgedByName"],
        escalation_id: map["escalationId"],
        escalation_step: map["escalationStep"],
        escalation_round: map["escalationRound"],
        escalates_at: map["escalatesAt"],
        rules: map["rules"],
        severity: map["severity"],
        metric: map["metric"],
        comparator: map["comparator"],
        threshold: map["threshold"],
        value: map["value"],
        peak: map["peak"],
        type: map["type"],
        resource_type: map["resourceType"],
        resource_id: map["resourceId"],
        notifications: map["notifications"],
        latency: map["latency"],
        result: map["result"]
    )
end

Instance Method Details

#to_map ⇒ Object



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/appwrite/models/alert.rb', line 129

def to_map
    {
        "$id": @id,
        "$createdAt": @created_at,
        "$updatedAt": @updated_at,
        "monitorId": @monitor_id,
        "projectId": @project_id,
        "name": @name,
        "status": @status,
        "resolvedAt": @resolved_at,
        "acknowledgedAt": @acknowledged_at,
        "acknowledgedBy": @acknowledged_by,
        "acknowledgedByName": @acknowledged_by_name,
        "escalationId": @escalation_id,
        "escalationStep": @escalation_step,
        "escalationRound": @escalation_round,
        "escalatesAt": @escalates_at,
        "rules": @rules,
        "severity": @severity,
        "metric": @metric,
        "comparator": @comparator,
        "threshold": @threshold,
        "value": @value,
        "peak": @peak,
        "type": @type,
        "resourceType": @resource_type,
        "resourceId": @resource_id,
        "notifications": @notifications,
        "latency": @latency,
        "result": @result
    }
end