Class: Katello::Resources::Registry::Proxy

Inherits:
Object
  • Object
show all
Defined in:
app/lib/katello/resources/registry.rb

Class Method Summary collapse

Class Method Details

.get(path, headers = {:accept => :json}, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
# File 'app/lib/katello/resources/registry.rb', line 11

def self.get(path, headers = {:accept => :json}, options = {})
  logger.debug "Sending GET request to Registry: #{path}"
  resource = RegistryResource.load_class
  joined_path = resource.prefix.chomp("/") + path
  client = resource.rest_client(Net::HTTP::Get, :get, joined_path)
  client.options.merge!(options)
  client.get(headers)
end

.loggerObject



7
8
9
# File 'app/lib/katello/resources/registry.rb', line 7

def self.logger
  ::Foreman::Logging.logger('katello/registry_proxy')
end

.patch(path, body, headers) ⇒ Object



27
28
29
30
31
32
# File 'app/lib/katello/resources/registry.rb', line 27

def self.patch(path, body, headers)
  logger.debug "Sending PATCH request to Registry: #{path}"
  resource = RegistryResource.load_class
  joined_path = resource.prefix.chomp("/") + path
  resource.issue_request(method: :patch, path: joined_path, headers: headers, payload: body)
end

.post(path, body, headers) ⇒ Object



34
35
36
37
38
39
# File 'app/lib/katello/resources/registry.rb', line 34

def self.post(path, body, headers)
  logger.debug "Sending PUT request to Registry: #{path}"
  resource = RegistryResource.load_class
  joined_path = resource.prefix.chomp("/") + path
  resource.issue_request(method: :post, path: joined_path, headers: headers, payload: body)
end

.put(path, body, headers) ⇒ Object



20
21
22
23
24
25
# File 'app/lib/katello/resources/registry.rb', line 20

def self.put(path, body, headers)
  logger.debug "Sending PUT request to Registry: #{path}"
  resource = RegistryResource.load_class
  joined_path = resource.prefix.chomp("/") + path
  resource.issue_request(method: :put, path: joined_path, headers: headers, payload: body)
end