Class: Appwrite::Models::Monitor

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, created_at:, updated_at:, name:, project_id:, rules:, type:, resource_type:, resource_id:, window:, cooldown:, enabled:, notify:, escalation_id:, severity:, status:, value: nil, evaluated_at: nil, alert_id:, triggered_at: nil, interval:, timeout:, url:, method: nil, headers: {}, body:, domain:, record: nil, resolver:, host:, port:, tls_mode: nil, result: nil, latency: nil, code: nil, certificate_expires_at: nil) ⇒ Monitor

Returns a new instance of Monitor.



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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/appwrite/models/monitor.rb', line 43

def initialize(
    id:,
    created_at:,
    updated_at:,
    name:,
    project_id:,
    rules:,
    type:,
    resource_type:,
    resource_id:,
    window:,
    cooldown:,
    enabled:,
    notify:,
    escalation_id:,
    severity:,
    status:,
    value: nil,
    evaluated_at: nil,
    alert_id:,
    triggered_at: nil,
    interval:,
    timeout:,
    url:,
    method: nil,
    headers: {},
    body:,
    domain:,
    record: nil,
    resolver:,
    host:,
    port:,
    tls_mode: nil,
    result: nil,
    latency: nil,
    code: nil,
    certificate_expires_at: nil
)
    @id = id
    @created_at = created_at
    @updated_at = updated_at
    @name = name
    @project_id = project_id
    @rules = rules
    @type = validate_type(type)
    @resource_type = validate_resource_type(resource_type)
    @resource_id = resource_id
    @window = window
    @cooldown = cooldown
    @enabled = enabled
    @notify = notify
    @escalation_id = escalation_id
    @severity = validate_severity(severity)
    @status = validate_status(status)
    @value = value
    @evaluated_at = evaluated_at
    @alert_id = alert_id
    @triggered_at = triggered_at
    @interval = interval
    @timeout = timeout
    @url = url
    @method = method.nil? ? method : validate_method(method)
    @headers = headers
    @body = body
    @domain = domain
    @record = record.nil? ? record : validate_record(record)
    @resolver = resolver
    @host = host
    @port = port
    @tls_mode = tls_mode.nil? ? tls_mode : validate_tls_mode(tls_mode)
    @result = result.nil? ? result : validate_result(result)
    @latency = latency
    @code = code
    @certificate_expires_at = certificate_expires_at
end

Instance Attribute Details

#alert_id ⇒ Object (readonly)

Returns the value of attribute alert_id.



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

def alert_id
  @alert_id
end

#body ⇒ Object (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#certificate_expires_at ⇒ Object (readonly)

Returns the value of attribute certificate_expires_at.



41
42
43
# File 'lib/appwrite/models/monitor.rb', line 41

def certificate_expires_at
  @certificate_expires_at
end

#code ⇒ Object (readonly)

Returns the value of attribute code.



40
41
42
# File 'lib/appwrite/models/monitor.rb', line 40

def code
  @code
end

#cooldown ⇒ Object (readonly)

Returns the value of attribute cooldown.



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

def cooldown
  @cooldown
end

#created_at ⇒ Object (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#domain ⇒ Object (readonly)

Returns the value of attribute domain.



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

def domain
  @domain
end

#enabled ⇒ Object (readonly)

Returns the value of attribute enabled.



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

def enabled
  @enabled
end

#escalation_id ⇒ Object (readonly)

Returns the value of attribute escalation_id.



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

def escalation_id
  @escalation_id
end

#evaluated_at ⇒ Object (readonly)

Returns the value of attribute evaluated_at.



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

def evaluated_at
  @evaluated_at
end

#headers ⇒ Object (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end

#host ⇒ Object (readonly)

Returns the value of attribute host.



35
36
37
# File 'lib/appwrite/models/monitor.rb', line 35

def host
  @host
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#interval ⇒ Object (readonly)

Returns the value of attribute interval.



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

def interval
  @interval
end

#latency ⇒ Object (readonly)

Returns the value of attribute latency.



39
40
41
# File 'lib/appwrite/models/monitor.rb', line 39

def latency
  @latency
end

#method ⇒ Object (readonly)

Returns the value of attribute method.



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

def method
  @method
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#notify ⇒ Object (readonly)

Returns the value of attribute notify.



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

def notify
  @notify
end

#port ⇒ Object (readonly)

Returns the value of attribute port.



36
37
38
# File 'lib/appwrite/models/monitor.rb', line 36

def port
  @port
end

#project_id ⇒ Object (readonly)

Returns the value of attribute project_id.



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

def project_id
  @project_id
end

#record ⇒ Object (readonly)

Returns the value of attribute record.



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

def record
  @record
end

#resolver ⇒ Object (readonly)

Returns the value of attribute resolver.



34
35
36
# File 'lib/appwrite/models/monitor.rb', line 34

def resolver
  @resolver
end

#resource_id ⇒ Object (readonly)

Returns the value of attribute resource_id.



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

def resource_id
  @resource_id
end

#resource_type ⇒ Object (readonly)

Returns the value of attribute resource_type.



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

def resource_type
  @resource_type
end

#result ⇒ Object (readonly)

Returns the value of attribute result.



38
39
40
# File 'lib/appwrite/models/monitor.rb', line 38

def result
  @result
end

#rules ⇒ Object (readonly)

Returns the value of attribute rules.



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

def rules
  @rules
end

#severity ⇒ Object (readonly)

Returns the value of attribute severity.



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

def severity
  @severity
end

#status ⇒ Object (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#timeout ⇒ Object (readonly)

Returns the value of attribute timeout.



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

def timeout
  @timeout
end

#tls_mode ⇒ Object (readonly)

Returns the value of attribute tls_mode.



37
38
39
# File 'lib/appwrite/models/monitor.rb', line 37

def tls_mode
  @tls_mode
end

#triggered_at ⇒ Object (readonly)

Returns the value of attribute triggered_at.



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

def triggered_at
  @triggered_at
end

#type ⇒ Object (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#updated_at ⇒ Object (readonly)

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

#url ⇒ Object (readonly)

Returns the value of attribute url.



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

def url
  @url
end

#value ⇒ Object (readonly)

Returns the value of attribute value.



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

def value
  @value
end

#window ⇒ Object (readonly)

Returns the value of attribute window.



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

def window
  @window
end

Class Method Details

.from(map:) ⇒ Object



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

def self.from(map:)
    map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "projectId" => "", "rules" => [], "type" => "usage", "resourceType" => "project", "resourceId" => "", "window" => 3600, "cooldown" => 3600, "enabled" => true, "notify" => ["owner"], "escalationId" => "", "severity" => "warning", "status" => "ok", "alertId" => "", "interval" => 0, "timeout" => 0, "url" => "", "body" => "", "domain" => "", "resolver" => "", "host" => "", "port" => 0 }.merge(map)
    Monitor.new(
        id: map["$id"],
        created_at: map["$createdAt"],
        updated_at: map["$updatedAt"],
        name: map["name"],
        project_id: map["projectId"],
        rules: map["rules"],
        type: map["type"],
        resource_type: map["resourceType"],
        resource_id: map["resourceId"],
        window: map["window"],
        cooldown: map["cooldown"],
        enabled: map["enabled"],
        notify: map["notify"],
        escalation_id: map["escalationId"],
        severity: map["severity"],
        status: map["status"],
        value: map["value"],
        evaluated_at: map["evaluatedAt"],
        alert_id: map["alertId"],
        triggered_at: map["triggeredAt"],
        interval: map["interval"],
        timeout: map["timeout"],
        url: map["url"],
        method: map["method"],
        headers: map["headers"],
        body: map["body"],
        domain: map["domain"],
        record: map["record"],
        resolver: map["resolver"],
        host: map["host"],
        port: map["port"],
        tls_mode: map["tlsMode"],
        result: map["result"],
        latency: map["latency"],
        code: map["code"],
        certificate_expires_at: map["certificateExpiresAt"]
    )
end

Instance Method Details

#to_map ⇒ Object



161
162
163
164
165
166
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
# File 'lib/appwrite/models/monitor.rb', line 161

def to_map
    {
        "$id": @id,
        "$createdAt": @created_at,
        "$updatedAt": @updated_at,
        "name": @name,
        "projectId": @project_id,
        "rules": @rules,
        "type": @type,
        "resourceType": @resource_type,
        "resourceId": @resource_id,
        "window": @window,
        "cooldown": @cooldown,
        "enabled": @enabled,
        "notify": @notify,
        "escalationId": @escalation_id,
        "severity": @severity,
        "status": @status,
        "value": @value,
        "evaluatedAt": @evaluated_at,
        "alertId": @alert_id,
        "triggeredAt": @triggered_at,
        "interval": @interval,
        "timeout": @timeout,
        "url": @url,
        "method": @method,
        "headers": @headers,
        "body": @body,
        "domain": @domain,
        "record": @record,
        "resolver": @resolver,
        "host": @host,
        "port": @port,
        "tlsMode": @tls_mode,
        "result": @result,
        "latency": @latency,
        "code": @code,
        "certificateExpiresAt": @certificate_expires_at
    }
end