Class: Jamf::RestrictedSoftware
- Defined in:
- lib/jamf/api/classic/api_objects/restricted_software.rb
Overview
Restricted Software items in the JSS.
Constant Summary collapse
- RSRC_BASE =
The base for REST resources of this class
'restrictedsoftware'.freeze
- RSRC_LIST_KEY =
the hash key used for the JSON list output of all objects in the JSS
:restricted_software
- RSRC_OBJECT_KEY =
The hash key used for the JSON object output. It’s also used in various error messages
:restricted_software
- SCOPE_TARGET_KEY =
Our scopes deal with computers
:computers
- OBJECT_HISTORY_OBJECT_TYPE =
the object type for this object in the object history table. See APIObject#add_object_history_entry
5
- SITE_SUBSET =
Where is the Site data in the API JSON?
:general
Instance Attribute Summary collapse
-
#delete_executable ⇒ Boolean
(also: #delete_executable?)
Whether to delete the executable.
-
#display_message ⇒ String
Message displayed to the user.
-
#kill_process ⇒ Boolean
(also: #kill_process?)
Whether to kill the running process.
-
#match_exact_process_name ⇒ Boolean
(also: #match_exact_process_name?)
Whether to return match exact process name.
-
#need_to_update ⇒ Boolean
included
from Updatable
readonly
Do we have unsaved changes?.
-
#process_name ⇒ String
The process name.
-
#scope ⇒ Object
included
from Scopable
Attribtues.
-
#send_notification ⇒ Boolean
(also: #send_notification?)
Whether to send a notification.
-
#site ⇒ Hash
The :name and :id of the site for this machine.
Instance Method Summary collapse
-
#clone(new_name, api: nil, cnx: nil) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
- #create ⇒ Object
-
#initialize(**args) ⇒ RestrictedSoftware
constructor
Instance Methods.
-
#name=(newname) ⇒ void
included
from Updatable
Change the name of this item Remember to #update to push changes to the server.
-
#parse_scope ⇒ void
included
from Scopable
private
Call this during initialization of objects that have a scope and the scope instance will be created from @init_data.
-
#should_update ⇒ void
included
from Scopable
When the scope changes, it calls this to tell us that an update is needed.
-
#site_assigned? ⇒ Boolean
included
from Sitable
Does this object have a site assigned?.
-
#site_id ⇒ Integer
included
from Sitable
The id of the site for this object.
-
#site_name ⇒ String
(also: #site)
included
from Sitable
The name of the site for this object.
-
#site_object ⇒ Jamf::Site
included
from Sitable
The Jamf::Site instance for this object’s site.
-
#unset_site ⇒ void
included
from Sitable
Set the site to nothing.
- #update ⇒ Object
Constructor Details
#initialize(**args) ⇒ RestrictedSoftware
Instance Methods
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 91 def initialize(**args) super @init_data[:general] ||= {} @process_name = @init_data[:general][:process_name] @match_exact_process_name = @init_data[:general][:match_exact_process_name] @send_notification = @init_data[:general][:send_notification] @kill_process = @init_data[:general][:kill_process] @delete_executable = @init_data[:general][:delete_executable] @display_message = @init_data[:general][:display_message] @site = Jamf::APIObject.get_name(@init_data[:general][:site]) @site ||= 'None' @scope ||= Jamf::Scopable::Scope.new SCOPE_TARGET_KEY, nil end |
Instance Attribute Details
#delete_executable ⇒ Boolean Also known as: delete_executable?
Returns whether to delete the executable.
80 81 82 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 80 def delete_executable @delete_executable end |
#display_message ⇒ String
Returns message displayed to the user.
83 84 85 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 83 def @display_message end |
#kill_process ⇒ Boolean Also known as: kill_process?
Returns whether to kill the running process.
77 78 79 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 77 def kill_process @kill_process end |
#match_exact_process_name ⇒ Boolean Also known as: match_exact_process_name?
Returns whether to return match exact process name.
71 72 73 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 71 def match_exact_process_name @match_exact_process_name end |
#need_to_update ⇒ Boolean (readonly) Originally defined in module Updatable
Returns do we have unsaved changes?.
#process_name ⇒ String
Returns the process name.
68 69 70 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 68 def process_name @process_name end |
#send_notification ⇒ Boolean Also known as: send_notification?
Returns whether to send a notification.
74 75 76 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 74 def send_notification @send_notification end |
#site ⇒ Hash
Returns the :name and :id of the site for this machine.
86 87 88 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 86 def site @site end |
Instance Method Details
#clone(new_name, api: nil, cnx: nil) ⇒ APIObject Originally defined in module Creatable
make a clone of this API object, with a new name. The class must be creatable
#create ⇒ Object
152 153 154 155 156 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 152 def create raise Jamf::MissingDataError, 'process_name must be set before creating' if @process_name.to_s.empty? raise Jamf::AlreadyExistsError, "A #{RSRC_OBJECT_KEY} named #{@name} already exists in the JSS" if self.class.all_names(:refresh, cnx: @cnx).include? @name super end |
#name=(newname) ⇒ void Originally defined in module Updatable
This method returns an undefined value.
Change the name of this item Remember to #update to push changes to the server.
#parse_scope ⇒ void Originally defined in module Scopable
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.
This method returns an undefined value.
Call this during initialization of objects that have a scope and the scope instance will be created from @init_data
#should_update ⇒ void Originally defined in module Scopable
This method returns an undefined value.
When the scope changes, it calls this to tell us that an update is needed.
#site_assigned? ⇒ Boolean Originally defined in module Sitable
Does this object have a site assigned?
#site_id ⇒ Integer Originally defined in module Sitable
The id of the site for this object.
#site_name ⇒ String Also known as: site Originally defined in module Sitable
The name of the site for this object. For backward compatibility, this is aliased to just ‘site’
#site_object ⇒ Jamf::Site Originally defined in module Sitable
The Jamf::Site instance for this object’s site
#unset_site ⇒ void Originally defined in module Sitable
This method returns an undefined value.
Set the site to nothing
#update ⇒ Object
158 159 160 161 |
# File 'lib/jamf/api/classic/api_objects/restricted_software.rb', line 158 def update raise Jamf::MissingDataError, 'process_name must be set before updating' if @process_name.to_s.empty? super end |