Class: Puppet::HTTP::Service Private
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a puppet web service
Direct Known Subclasses
Defined Under Namespace
Classes: Ca, Compiler, FileServer, Puppetserver, Report
Constant Summary collapse
- SERVICE_NAMES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns available services.
[:ca, :fileserver, :puppet, :puppetserver, :report].freeze
- EXCLUDED_FORMATS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns format types that are unsupported.
[:yaml, :b64_zlib_yaml, :dot].freeze
Instance Attribute Summary collapse
-
#url ⇒ URI
readonly
private
The url associated with this service.
Class Method Summary collapse
-
.create_service(client, session, name, server = nil, port = nil) ⇒ Puppet::HTTP::Service
private
Create a new web service, which contains the URL used to connect to the service.
-
.valid_name?(name) ⇒ Boolean
private
Check if the service named is included in the list of available services.
Instance Method Summary collapse
-
#connect(ssl_context: nil) ⇒ Object
private
Open a connection using the given ssl context.
-
#initialize(client, session, url) ⇒ Service
constructor
private
Create a new service.
-
#with_base_url(path) ⇒ URI
private
Return the url with the given path encoded and appended.
Constructor Details
#initialize(client, session, url) ⇒ Service
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new service
77 78 79 80 81 |
# File 'lib/puppet/http/service.rb', line 77 def initialize(client, session, url) @client = client @session = session @url = url end |
Instance Attribute Details
#url ⇒ URI (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the url associated with this service.
9 10 11 |
# File 'lib/puppet/http/service.rb', line 9 def url @url end |
Class Method Details
.create_service(client, session, name, server = nil, port = nil) ⇒ Puppet::HTTP::Service
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new web service, which contains the URL used to connect to the service. The four services implemented are :ca, :fileserver, :puppet, and :report.
The :ca and :report services handle certs and reports, respectively. The :fileserver service handles puppet file metadata and content requests. And the default service, :puppet, handles nodes, facts, and catalogs.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puppet/http/service.rb', line 38 def self.create_service(client, session, name, server = nil, port = nil) case name when :ca Puppet::HTTP::Service::Ca.new(client, session, server, port) when :fileserver Puppet::HTTP::Service::FileServer.new(client, session, server, port) when :puppet ::Puppet::HTTP::Service::Compiler.new(client, session, server, port) when :puppetserver ::Puppet::HTTP::Service::Puppetserver.new(client, session, server, port) when :report Puppet::HTTP::Service::Report.new(client, session, server, port) else raise ArgumentError, "Unknown service #{name}" end end |
.valid_name?(name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if the service named is included in the list of available services.
64 65 66 |
# File 'lib/puppet/http/service.rb', line 64 def self.valid_name?(name) SERVICE_NAMES.include?(name) end |
Instance Method Details
#connect(ssl_context: nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Open a connection using the given ssl context
106 107 108 |
# File 'lib/puppet/http/service.rb', line 106 def connect(ssl_context: nil) @client.connect(@url, options: {ssl_context: ssl_context}) end |
#with_base_url(path) ⇒ URI
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the url with the given path encoded and appended
92 93 94 95 96 |
# File 'lib/puppet/http/service.rb', line 92 def with_base_url(path) u = @url.dup u.path += Puppet::Util.uri_encode(path) u end |