Class: Katello::Resources::Candlepin::UpstreamJob

Inherits:
UpstreamCandlepinResource show all
Defined in:
app/lib/katello/resources/candlepin/upstream_job.rb

Constant Summary collapse

NOT_FINISHED_STATES =
%w(CREATED WAITING PENDING RUNNING).freeze
API_URL =
'https://subscription.rhsm.redhat.com/subscription'.freeze

Constants inherited from HttpResource

HttpResource::REQUEST_MAP

Instance Attribute Summary

Attributes inherited from HttpResource

#json

Class Method Summary collapse

Methods inherited from UpstreamCandlepinResource

client_cert, client_key, json_resource, resource, rest_client, site, upstream_api_uri, upstream_consumer, upstream_consumer_id, upstream_id_cert, upstream_owner_id

Methods included from Util::HttpProxy

#proxy, #proxy_host, #proxy_port, #proxy_scheme, #proxy_uri

Methods inherited from CandlepinResource

default_headers, fetch_paged, included_list, logger, name_to_key, process_response, raise_rest_client_exception

Methods inherited from HttpResource

#[], #[]=, hash_to_query, #initialize, issue_request, join_path, logger, process_response, raise_rest_client_exception, rest_client

Methods included from Concerns::FilterSensitiveData

#filter_sensitive_data

Constructor Details

This class inherits a constructor from Katello::HttpResource

Class Method Details

.get(id, upstream) ⇒ Object



13
14
15
16
17
18
19
# File 'app/lib/katello/resources/candlepin/upstream_job.rb', line 13

def get(id, upstream)
  url = API_URL
  response = Resources::Candlepin::UpstreamConsumer.get_export("#{url}#{path(id)}", upstream['idCert']['cert'],
    upstream['idCert']['key'], nil)
  job = JSON.parse(response)
  job.with_indifferent_access
end

.not_finished?(job) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/lib/katello/resources/candlepin/upstream_job.rb', line 9

def not_finished?(job)
  NOT_FINISHED_STATES.include?(job[:state])
end

.path(id = nil) ⇒ Object



21
22
23
# File 'app/lib/katello/resources/candlepin/upstream_job.rb', line 21

def path(id = nil)
  "/jobs/#{id}"
end