Class: JSS::DirectoryBinding
- Includes:
- Creatable, DirectoryBindingType, Updatable
- Defined in:
- lib/jss/api_object/directory_binding.rb,
lib/jss.rb
Overview
“JSS::DirectoryBinding.fetch name: 'BindingName'” seems to be returning a 500 error in my test evironment. Use “JSS::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" => JSS::DirectoryBindingType::OpenDirectory, "Active Directory" => JSS::DirectoryBindingType::ActiveDirectory, "PowerBroker Identity Services" => JSS::DirectoryBindingType::PowerBroker, "ADmitMac" => JSS::DirectoryBindingType::ADmitMac, "Centrify" => JSS::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) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
-
#create ⇒ Integer
included
from Creatable
Create a new object in the JSS.
-
#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.
-
#update ⇒ Boolean
included
from Updatable
Save changes to the JSS.
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: JSS::DirectoryBinding.make name: “Example Binding”, username: “BindingUser”, password: “SuperMonkey123”, computer_ou: “computers”, active_directory: { multiple_domains: false }, domain: your.domain.server
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/jss/api_object/directory_binding.rb', line 110 def initialize(args = {}) super args if self.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 self.set_type_settings (DIRECTORY_BINDING_TYPE_CLASSES[@type.to_s].new @init_data[class_key]) else # Build raise JSS::MissingDataError, "domain must be provided." if @init_data[:domain].nil? raise JSS::MissingDataError, "username must be provided." if @init_data[:username].nil? raise JSS::MissingDataError, "computer_ou must be provided." if @init_data[:computer_ou].nil? raise JSS::MissingDataError, "password must be provided when creating a DirectoryBinding object." if @init_data[:password].nil? raise JSS::MissingDataError, "Type must be provided, one of \":#{DIRECTORY_BINDING_TYPE.keys.join(",:")}\"." if @init_data[:type].nil? raise JSS::InvalidDataError, "Type must be one of \":#{DIRECTORY_BINDING_TYPE.keys.join(",:")}\"." unless DIRECTORY_BINDING_TYPE.keys.include? @init_data[:type] raise JSS::InvalidDataError, "Priority must be between 1 and 10" if !@init_data[:priority].nil? && (@init_data[:priority] <= 1 || @init_data[:priority] >= 10) @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 self.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.
98 99 100 |
# File 'lib/jss/api_object/directory_binding.rb', line 98 def computer_ou @computer_ou end |
#domain ⇒ Object
Returns the value of attribute domain.
95 96 97 |
# File 'lib/jss/api_object/directory_binding.rb', line 95 def domain @domain end |
#id ⇒ Object (readonly)
Attributes
92 93 94 |
# File 'lib/jss/api_object/directory_binding.rb', line 92 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
93 94 95 |
# File 'lib/jss/api_object/directory_binding.rb', line 93 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.
101 102 103 |
# File 'lib/jss/api_object/directory_binding.rb', line 101 def password @password end |
#password_sha256 ⇒ Object (readonly)
Returns the value of attribute password_sha256.
97 98 99 |
# File 'lib/jss/api_object/directory_binding.rb', line 97 def password_sha256 @password_sha256 end |
#priority ⇒ Object
Returns the value of attribute priority.
94 95 96 |
# File 'lib/jss/api_object/directory_binding.rb', line 94 def priority @priority end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
99 100 101 |
# File 'lib/jss/api_object/directory_binding.rb', line 99 def type @type end |
#type_settings ⇒ Object (readonly)
Returns the value of attribute type_settings.
100 101 102 |
# File 'lib/jss/api_object/directory_binding.rb', line 100 def type_settings @type_settings end |
#username ⇒ Object
Returns the value of attribute username.
96 97 98 |
# File 'lib/jss/api_object/directory_binding.rb', line 96 def username @username end |
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
#create ⇒ Integer Originally defined in module Creatable
Create a new object in the JSS.
#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
#update ⇒ Boolean Originally defined in module Updatable
Save changes to the JSS