Module: Legion::Extensions::Github::App::Runners::Installations

Includes:
Helpers::Client, Helpers::Lex
Included in:
Client
Defined in:
lib/legion/extensions/github/app/runners/installations.rb

Constant Summary

Constants included from Helpers::Client

Helpers::Client::CREDENTIAL_RESOLVERS

Constants included from Helpers::TokenCache

Helpers::TokenCache::TOKEN_BUFFER_SECONDS

Instance Method Summary collapse

Methods included from Helpers::Client

#connection, #gh_cli_token_output, #max_fallback_retries, #on_rate_limit, #on_scope_authorized, #on_scope_denied, #resolve_broker_app, #resolve_credential, #resolve_env, #resolve_gh_cli, #resolve_next_credential, #resolve_settings_app, #resolve_settings_delegated, #resolve_settings_pat, #resolve_vault_app, #resolve_vault_delegated, #resolve_vault_pat

Methods included from Helpers::ScopeRegistry

#credential_fingerprint, #invalidate_scope, #mark_rate_limited, #rate_limited?, #register_scope, #scope_status

Methods included from Helpers::TokenCache

#fetch_token, #mark_rate_limited, #rate_limited?, #store_token

Instance Method Details

#delete_installation(jwt:, installation_id:) ⇒ Object



43
44
45
46
47
# File 'lib/legion/extensions/github/app/runners/installations.rb', line 43

def delete_installation(jwt:, installation_id:, **)
  conn = connection(token: jwt, **)
  response = conn.delete("/app/installations/#{installation_id}")
  { result: response.status == 204 }
end

#get_installation(jwt:, installation_id:) ⇒ Object



19
20
21
22
23
# File 'lib/legion/extensions/github/app/runners/installations.rb', line 19

def get_installation(jwt:, installation_id:, **)
  conn = connection(token: jwt, **)
  response = conn.get("/app/installations/#{installation_id}")
  { result: response.body }
end

#list_installation_repos(per_page: 30, page: 1) ⇒ Object



25
26
27
28
29
# File 'lib/legion/extensions/github/app/runners/installations.rb', line 25

def list_installation_repos(per_page: 30, page: 1, **)
  response = connection(**).get('/installation/repositories',
                                per_page: per_page, page: page)
  { result: response.body }
end

#list_installations(jwt:, per_page: 30, page: 1) ⇒ Object



13
14
15
16
17
# File 'lib/legion/extensions/github/app/runners/installations.rb', line 13

def list_installations(jwt:, per_page: 30, page: 1, **)
  conn = connection(token: jwt, **)
  response = conn.get('/app/installations', per_page: per_page, page: page)
  { result: response.body }
end

#suspend_installation(jwt:, installation_id:) ⇒ Object



31
32
33
34
35
# File 'lib/legion/extensions/github/app/runners/installations.rb', line 31

def suspend_installation(jwt:, installation_id:, **)
  conn = connection(token: jwt, **)
  response = conn.put("/app/installations/#{installation_id}/suspended")
  { result: response.status == 204 }
end

#unsuspend_installation(jwt:, installation_id:) ⇒ Object



37
38
39
40
41
# File 'lib/legion/extensions/github/app/runners/installations.rb', line 37

def unsuspend_installation(jwt:, installation_id:, **)
  conn = connection(token: jwt, **)
  response = conn.delete("/app/installations/#{installation_id}/suspended")
  { result: response.status == 204 }
end