Class: JSS::PatchExternalSource

Inherits:
PatchSource show all
Includes:
Creatable
Defined in:
lib/jss/api_object/patch_source/patch_external_source.rb

Overview

An 'External' patch source. These sources are defined by Jamf Admins and can be created, modified or deleted.

See Also:

Constant Summary collapse

RSRC_BASE =

The base for REST resources of this class

'patchexternalsources'.freeze
RSRC_LIST_KEY =

the hash key used for the JSON list output of all objects in the JSS

:patch_external_sources
RSRC_OBJECT_KEY =

The hash key used for the JSON object output. It's also used in various error messages

:patch_external_source
VALID_DATA_KEYS =

these keys, as well as :id and :name, are present in valid API JSON data for this class

%i[enabled ssl_enabled host_name].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from JSS::PatchSource

Instance Attribute Details

#need_to_updateBoolean (readonly) Originally defined in module Updatable

Returns do we have unsaved changes?

Returns:

  • (Boolean)

    do we have unsaved changes?

Instance Method Details

#clone(new_name, api: nil) ⇒ APIObject Originally defined in module Creatable

make a clone of this API object, with a new name. The class must be creatable

Parameters:

  • name (String)

    the name for the new object

  • api (JSS::APIConnection)

    the API in which to create the object Defaults to the API used to instantiate this object

Returns:

  • (APIObject)

    An uncreated clone of this APIObject with the given name

Raises:

#createObject


120
121
122
123
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 120

def create
  validate_host_port('create a patch source')
  super
end

#disablevoid

This method returns an undefined value.

Disable this source for retrieving patch info


72
73
74
75
76
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 72

def disable
  return unless enabled?
  @enabled = false
  @need_to_update = true
end

#enablevoid

This method returns an undefined value.

Enable this source for retrieving patch info


61
62
63
64
65
66
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 61

def enable
  return if enabled?
  validate_host_port('enable a patch source')
  @enabled = true
  @need_to_update = true
end

#host_name=(newname) ⇒ Object Also known as: hostname=, host=

see PatchSource attr_reader :host_name


80
81
82
83
84
85
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 80

def host_name=(newname)
  return if newname == host_name
  raise JSS::InvalidDataError, 'names must be String' unless name.is_a? String
  @host_name = name
  @need_to_update = true
end

#no_sslvoid Also known as: disable_ssl

This method returns an undefined value.

Do not use SSL for connecting to the source host


113
114
115
116
117
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 113

def no_ssl
  return unless ssl_enabled?
  @ssl_enabled = false
  @need_to_update = true
end

#port=(new_port) ⇒ Object

see PatchSource attr_reader :port


91
92
93
94
95
96
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 91

def port=(new_port)
  return if new_port == port
  raise JSS::InvalidDataError, 'ports must be Integers' unless port.is_a? Integer
  @port = new_port
  @need_to_update = true
end

#updateObject


125
126
127
128
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 125

def update
  validate_host_port('update a patch source')
  super
end

#use_sslvoid Also known as: enable_ssl

This method returns an undefined value.

Use SSL for connecting to the source host


102
103
104
105
106
# File 'lib/jss/api_object/patch_source/patch_external_source.rb', line 102

def use_ssl
  return if ssl_enabled?
  @ssl_enabled = true
  @need_to_update = true
end