class Jamf::PatchExternalSource
An ‘External’ patch source. These sources are defined by Jamf
Admins and can be created, modified or deleted.
@see Jamf::APIObject
Constants
- RSRC_BASE
The base for REST resources of this class
- RSRC_LIST_KEY
the hash key used for the JSON list output of all objects in the
JSS
- RSRC_OBJECT_KEY
The hash key used for the JSON object output. It’s also used in various error messages
Public Instance Methods
Jamf::PatchSource::create
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 118 def create 119 validate_host_port('create a patch source') 120 super 121 end
Disable this source for retrieving patch info
@return [void]
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 70 def disable 71 return unless enabled? 72 @enabled = false 73 @need_to_update = true 74 end
Enable this source for retrieving patch info
@return [void]
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 59 def enable 60 return if enabled? 61 validate_host_port('enable a patch source') 62 @enabled = true 63 @need_to_update = true 64 end
see PatchSource
attr_reader :host_name
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 78 def host_name=(newname) 79 return if newname == host_name 80 raise Jamf::InvalidDataError, 'names must be String' unless name.is_a? String 81 @host_name = name 82 @need_to_update = true 83 end
Do not use SSL for connecting to the source host
@return [void]
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 111 def no_ssl 112 return unless ssl_enabled? 113 @ssl_enabled = false 114 @need_to_update = true 115 end
see PatchSource
attr_reader :port
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 89 def port=(new_port) 90 return if new_port == port 91 raise Jamf::InvalidDataError, 'ports must be Integers' unless port.is_a? Integer 92 @port = new_port 93 @need_to_update = true 94 end
Jamf::APIObject#update
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 123 def update 124 validate_host_port('update a patch source') 125 super 126 end
Use SSL for connecting to the source host
@return [void]
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 100 def use_ssl 101 return if ssl_enabled? 102 @ssl_enabled = true 103 @need_to_update = true 104 end
Private Instance Methods
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 141 def rest_xml 142 doc = REXML::Document.new 143 src = doc.add_element self.class::RSRC_OBJECT_KEY.to_s 144 src.add_element('enabled').text = @enabled.to_s 145 src.add_element('name').text = @name 146 src.add_element('ssl_enabled').text = @ssl_enabled.to_s 147 src.add_element('host_name').text = @host_name 148 src.add_element('port').text = @port.to_s 149 doc.to_s 150 end
raise an exeption if needed when trying to do something that needs a host and port set
@param action The action that needs a host and port
@return [void]
# File lib/jamf/api/classic/api_objects/patch_external_source.rb 137 def validate_host_port(action) 138 raise Jamf::UnsupportedError, "Cannot #{action} without first setting a host_name and port" if host_name.to_s.empty? || port.to_s.empty? 139 end