Class: Proxy::ContainerGateway::ForemanApi
- Inherits:
-
HttpRequest::ForemanRequest
- Object
- HttpRequest::ForemanRequest
- Proxy::ContainerGateway::ForemanApi
- Defined in:
- lib/smart_proxy_container_gateway/foreman_api.rb
Instance Method Summary collapse
- #fetch_host_repositories(uuid, params) ⇒ Object
- #fetch_token(auth_header, params) ⇒ Object
- #fetch_user_repositories(auth_header, params) ⇒ Object
- #registry_request(auth_header, params, suffix, uuid: '', cert: false) ⇒ Object
Instance Method Details
#fetch_host_repositories(uuid, params) ⇒ Object
26 27 28 |
# 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) ⇒ Object
18 19 20 |
# 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) ⇒ Object
22 23 24 |
# 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) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# 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 |