Module: Legion::Extensions::Lakera::Runners::Health

Extended by:
Helpers::Client
Includes:
Helpers::Lex
Included in:
Client
Defined in:
lib/legion/extensions/lakera/runners/health.rb

Constant Summary

Constants included from Helpers::Client

Helpers::Client::DEFAULT_HOST, Helpers::Client::REGIONS

Instance Method Summary collapse

Methods included from Helpers::Client

client, self_hosted_client

Instance Method Details

#live(host:) ⇒ Object



40
41
42
43
44
# File 'lib/legion/extensions/lakera/runners/health.rb', line 40

def live(host:, **)
  conn = Helpers::Client.self_hosted_client(host: host, **)
  response = conn.get('/livez')
  Helpers::Response.handle_response(response)
end

#policy_health(api_key: nil, project_id: nil, host: nil) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/legion/extensions/lakera/runners/health.rb', line 13

def policy_health(api_key: nil, project_id: nil, host: nil, **)
  body = {}
  body[:project_id] = project_id if project_id

  conn = resolve_health_client(api_key: api_key, host: host, **)
  response = conn.post('/v2/policies/health', body)
  Helpers::Response.handle_response(response)
end

#policy_lint(api_key: nil, host: nil) ⇒ Object



22
23
24
25
26
# File 'lib/legion/extensions/lakera/runners/health.rb', line 22

def policy_lint(api_key: nil, host: nil, **)
  conn = resolve_health_client(api_key: api_key, host: host, **)
  response = conn.post('/v2/policies/lint')
  Helpers::Response.handle_response(response)
end

#ready(host:) ⇒ Object



34
35
36
37
38
# File 'lib/legion/extensions/lakera/runners/health.rb', line 34

def ready(host:, **)
  conn = Helpers::Client.self_hosted_client(host: host, **)
  response = conn.get('/readyz')
  Helpers::Response.handle_response(response)
end

#startup(host:) ⇒ Object



28
29
30
31
32
# File 'lib/legion/extensions/lakera/runners/health.rb', line 28

def startup(host:, **)
  conn = Helpers::Client.self_hosted_client(host: host, **)
  response = conn.get('/startupz')
  Helpers::Response.handle_response(response)
end