class Proxy::ContainerGateway::ForemanApi

Public Instance Methods

fetch_host_repositories(uuid, params) click to toggle source
# File lib/smart_proxy_container_gateway/foreman_api.rb, line 26
def fetch_host_repositories(uuid, params)
  registry_request(nil, params, '_catalog', uuid: uuid, cert: true)
end
fetch_token(auth_header, params) click to toggle source
# File lib/smart_proxy_container_gateway/foreman_api.rb, line 18
def fetch_token(auth_header, params)
  registry_request(auth_header, params, 'token')
end
fetch_user_repositories(auth_header, params) click to toggle source
# File lib/smart_proxy_container_gateway/foreman_api.rb, line 22
def fetch_user_repositories(auth_header, params)
  registry_request(auth_header, params, '_catalog')
end
registry_request(auth_header, params, suffix, uuid: '', cert: false) click to toggle source
# File lib/smart_proxy_container_gateway/foreman_api.rb, line 6
def registry_request(auth_header, params, suffix, uuid: '', cert: false)
  path = "#{Proxy::ContainerGateway::Plugin.settings.katello_registry_path}#{suffix}"
  query = params.slice('scope', 'account').compact

  headers = {}
  headers['Authorization'] = auth_header unless cert
  headers['HostUUID'] = uuid if cert

  req = request_factory.create_get(path, query, headers)
  send_request(req)
end