Class: Jamf::DirectoryBinding
- Includes:
- Creatable, DirectoryBindingType, Updatable
- Defined in:
- lib/jamf/api/classic/api_objects/directory_binding.rb
Overview
“Jamf::DirectoryBinding.fetch name: ‘BindingName’” seems to be returning a 500 error in my test evironment. Use “Jamf::DirectoryBinding.fetch ‘BindingName’ instead.”
A Directory Binding object in the JSS These are rather complex objects, and contain settings specific to the directory object’s type.
Constant Summary collapse
- DIRECTORY_BINDING_TYPE =
! You CAN update this
{ open_directory: 'Open Directory', active_directory: 'Active Directory', powerbroker_identity_services: 'PowerBroker Identity Services', admitmac: 'ADmitMac', centrify: 'Centrify' }.freeze
- DIRECTORY_BINDING_TYPE_CLASSES =
{ 'Open Directory' => Jamf::DirectoryBindingType::OpenDirectory, 'Active Directory' => Jamf::DirectoryBindingType::ActiveDirectory, 'PowerBroker Identity Services' => Jamf::DirectoryBindingType::PowerBroker, 'ADmitMac' => Jamf::DirectoryBindingType::ADmitMac, 'Centrify' => Jamf::DirectoryBindingType::Centrify }
- RSRC_BASE =
The base for REST resources of this class
'directorybindings'.freeze
- RSRC_LIST_KEY =
the hash key used for the JSON list output of all objects in the JSS
:directory_bindings- RSRC_OBJECT_KEY =
The hash key used for the JSON object output. It’s also used in various error messages
:directory_binding
Instance Attribute Summary collapse
-
#computer_ou ⇒ Object
Returns the value of attribute computer_ou.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#need_to_update ⇒ Boolean
included
from Updatable
readonly
Do we have unsaved changes?.
-
#password ⇒ Object
Returns the value of attribute password.
-
#password_sha256 ⇒ Object
readonly
Returns the value of attribute password_sha256.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_settings ⇒ Object
readonly
Returns the value of attribute type_settings.
-
#username ⇒ Object
Returns the value of attribute username.
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.
-
#initialize(**args) ⇒ DirectoryBinding
constructor
Constructor objects name and then the settings.
-
#name=(newname) ⇒ void
included
from Updatable
Change the name of this item Remember to #update to push changes to the server.
- #set_type_settings(settings) ⇒ Object included from DirectoryBindingType
-
#should_update ⇒ Object
included
from DirectoryBindingType
Module Methods.
Constructor Details
#initialize(**args) ⇒ DirectoryBinding
When creating an object with specific properties use the
Constructor objects name and then the settings. Ex: Creating an Active Directory object: Jamf::DirectoryBinding.make name: “Example Binding”, username: “BindingUser”, password: “SuperMonkey123”, computer_ou: “computers”, active_directory: { multiple_domains: false }, domain: your.domain.server
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 84 def initialize(**args) super if in_jss? @priority = @init_data[:priority] @domain = @init_data[:domain] @username = @init_data[:username] @password_sha256 = @init_data[:password_sha256] @computer_ou = @init_data[:computer_ou] @type = @init_data[:type] class_key = DIRECTORY_BINDING_TYPE.select { |_k, v| v == @type }.map { |k, _v| k }.first set_type_settings(DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new(@init_data[class_key])) else # Build raise Jamf::MissingDataError, 'domain must be provided.' if @init_data[:domain].nil? raise Jamf::MissingDataError, 'username must be provided.' if @init_data[:username].nil? raise Jamf::MissingDataError, 'computer_ou must be provided.' if @init_data[:computer_ou].nil? raise Jamf::MissingDataError, 'password must be provided when creating a DirectoryBinding object.' if @init_data[:password].nil? raise Jamf::MissingDataError, "Type must be provided, one of \":#{DIRECTORY_BINDING_TYPE.keys.join(',:')}\"." if @init_data[:type].nil? unless DIRECTORY_BINDING_TYPE.keys.include? @init_data[:type] raise Jamf::InvalidDataError, "Type must be one of \":#{DIRECTORY_BINDING_TYPE.keys.join(',:')}\"." end if !@init_data[:priority].nil? && (@init_data[:priority] <= 1 || @init_data[:priority] >= 10) raise Jamf::InvalidDataError, 'Priority must be between 1 and 10' end @domain = @init_data[:domain] @username = @init_data[:username] @computer_ou = @init_data[:computer_ou] @type = DIRECTORY_BINDING_TYPE[@init_data[:type]] @password = @init_data[:password] @priority = @init_data[:priority] @priority = 1 if @priority.nil? class_key = DIRECTORY_BINDING_TYPE.select { |_k, v| v == @type }.map { |k, _v| k }.first set_type_settings(DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new(@init_data[class_key])) end end |
Instance Attribute Details
#computer_ou ⇒ Object
Returns the value of attribute computer_ou.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def computer_ou @computer_ou end |
#domain ⇒ Object
Returns the value of attribute domain.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def domain @domain end |
#id ⇒ Object (readonly)
Attributes
74 75 76 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 74 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def name @name end |
#need_to_update ⇒ Boolean (readonly) Originally defined in module Updatable
Returns do we have unsaved changes?.
#password ⇒ Object
Returns the value of attribute password.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def password @password end |
#password_sha256 ⇒ Object (readonly)
Returns the value of attribute password_sha256.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def password_sha256 @password_sha256 end |
#priority ⇒ Object
Returns the value of attribute priority.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def priority @priority end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def type @type end |
#type_settings ⇒ Object (readonly)
Returns the value of attribute type_settings.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def type_settings @type_settings end |
#username ⇒ Object
Returns the value of attribute username.
75 76 77 |
# File 'lib/jamf/api/classic/api_objects/directory_binding.rb', line 75 def username @username 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
#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.
#set_type_settings(settings) ⇒ Object Originally defined in module DirectoryBindingType
#should_update ⇒ Object Originally defined in module DirectoryBindingType
Module Methods