class Jamf::ComputerInvitation
This class represents a Computer
Invitation in the JSS
.
Adding Computer
Invitations to the JSS
¶ ↑
This class is meant only to generate and hold the response of creating an invitation.
Constants
- OBJECT_HISTORY_OBJECT_TYPE
the object type for this object in the object history table. See {APIObject#add_object_history_entry}
- OTHER_LOOKUP_KEYS
See
Jamf::APIObject
- 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
- SITE_SUBSET
Where is site data located in the API JSON?
Attributes
@return [String] whether or not to create the account if required
“true” or “false” are valid values.
@return [String]
Time
since epoch that the invitation will expire at.
Note: defaults to “Unlimited”, so only set if it should expire.
@return [String]
The whether or not to hide the ssh user.
@return [String]
The invitation_status.
@return [String] the invitation type
Valid values are: URL and EMAIL. Will default to DEFAULT.
@return [String]
Whether the invitation can be used multiple times (boolean).
@return [String] the invitation name
@return [String]
The username of the ssh user to be created.
REQUIRED for valid setup.
Public Class Methods
@see APIObject#initialize
Jamf::APIObject::new
# File lib/jamf/api/classic/api_objects/computer_invitation.rb 136 def initialize(args = { 137 id: :new, 138 name: 'some_new_name', 139 ssh_username: 'casper_remote', 140 hide_account: 'true' 141 }) 142 143 super args 144 145 @name = @init_data[:invitation] 146 @invitation_type = @init_data[:invitation_type] 147 @create_account_if_does_not_exist = @init_data[:create_account_if_does_not_exist] 148 @expiration_date_epoch = @init_data[:expiration_date_epoch] || args[:expiration_date_epoch] 149 @ssh_username = @init_data[:ssh_username] || args[:ssh_username] 150 @hide_account = @init_data[:hide_account] || args[:hide_account] 151 @invitation_status = @init_data[:invitation_status] || args[:invitation_status] 152 @multiple_uses_allowed = @init_data[:multiple_uses_allowed] || args[:multiple_uses_allowed] 153 end
Public Instance Methods
Needed to support creation of new Computer
Invitations to set their name.
@return [Jamf::ComputerInvitation]
Jamf::APIObject::create
# File lib/jamf/api/classic/api_objects/computer_invitation.rb 162 def create 163 new_invitation_id = super 164 165 jss_me = ComputerInvitation.fetch(id: new_invitation_id, name: 'set_by_request') 166 @name = jss_me.name 167 @invitation_type = jss_me.invitation_type 168 @create_account_if_does_not_exist = jss_me.create_account_if_does_not_exist 169 @expiration_date_epoch = jss_me.expiration_date_epoch 170 @ssh_username = jss_me.ssh_username 171 @hide_account = jss_me.hide_account 172 @invitation_status = jss_me.invitation_status 173 @multiple_uses_allowed = jss_me.multiple_uses_allowed 174 end
Private Instance Methods
Sets invitation expiration 4 hours after request.
# File lib/jamf/api/classic/api_objects/computer_invitation.rb 182 def rest_xml 183 doc = REXML::Document.new Jamf::Connection::XML_HEADER 184 obj = doc.add_element RSRC_OBJECT_KEY.to_s 185 obj.add_element('invitation_type').text = invitation_type 186 obj.add_element('create_account_if_does_not_exist').text = create_account_if_does_not_exist 187 if expiration_date_epoch 188 obj.add_element('expiration_date_epoch').text = expiration_date_epoch 189 end 190 obj.add_element('ssh_username').text = ssh_username 191 obj.add_element('hide_account').text = hide_account 192 obj.add_element('invitation_status').text = invitation_status 193 obj.add_element('multiple_uses_allowed').text = multiple_uses_allowed 194 add_site_to_xml(doc) 195 doc.to_s 196 end