Class: SoftLayer::SoftwarePassword

Inherits:
ModelBase
  • Object
show all
Includes:
DynamicAttribute
Defined in:
lib/softlayer/SoftwarePassword.rb

Overview

Each SoftLayer SoftwarePassword instance provides information about a user’s password associated with a SoftLayer Software instance.

This class roughly corresponds to the entity SoftLayer_Software_Component_Password in the API.

Instance Attribute Summary

Attributes inherited from ModelBase

#softlayer_client

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DynamicAttribute

included

Methods inherited from ModelBase

#[], #has_sl_property?, #initialize, #refresh_details, sl_attr, #to_ary

Constructor Details

This class inherits a constructor from SoftLayer::ModelBase

Class Method Details

.find_passwords_for_application_delivery_controllers(options_hash = {}) ⇒ Object

Retrieve a list of software passwords from application delivery controllers.

The options parameter should contain:

:client - The client used to connect to the API

If no client is given, then the routine will try to use Client.default_client If no client can be found the routine will raise an error.

You may filter the list returned by adding options:

  • :datacenter (string/array) - Include software passwords from application delivery controllers matching this datacenter

  • :name (string/array) - Include software passwords from application delivery controllers that matches this name

  • :tags (string/array - Include software passwords from application delivery controllers that matches these tags

  • :username (string/array) - Include software passwords that match this username

Additionally you may provide options related to the request itself:

  • :application_delivery_controller_object_filter (ObjectFilter) - Include software passwords from application delivery controllers

    that matches the criteria of this object filter
    
  • :software_password_object_filter (ObjectFilter) - Include software passwords that match the criteria of this object filter

  • :software_password_object_mask (string) - The object mask of properties you wish to receive for the items returned.

    If not provided, the result will use the default object mask
    


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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/softlayer/SoftwarePassword.rb', line 94

def self.find_passwords_for_application_delivery_controllers(options_hash = {})
  softlayer_client = options_hash[:client] || Client.default_client
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client

  if(options_hash.has_key? :application_delivery_controller_object_filter)
    application_delivery_controller_object_filter = options_hash[:application_delivery_controller_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless application_delivery_controller_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    application_delivery_controller_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :software_password_object_filter)
    software_password_object_filter = options_hash[:software_password_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless software_password_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    software_password_object_filter = ObjectFilter.new()
  end

  option_to_filter_path = {
    :app_deliv_controller => {
      :advanced_mode     => "applicationDeliveryControllers.advancedModeFlag",
      :datacenter        => "applicationDeliveryControllers.datacenter.name",
      :name              => "applicationDeliveryControllers.name",
      :tags              => "applicationDeliveryControllers.tagReferences.tag.name"
    },
    :software_password    => {
      :username        => "password.username"
    }
  }

  application_delivery_controller_object_filter.modify { |filter| filter.accept(option_to_filter_path[:app_deliv_controller][:advanced_mode]).when_it is(true) }

  option_to_filter_path[:app_deliv_controller].each do |option, filter_path|
    next if option == :advanced_mode

    if options_hash[option]
      application_delivery_controller_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) }
    end
  end

  option_to_filter_path[:software_password].each do |option, filter_path|
    software_password_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

   = softlayer_client[:Account]
   = .object_filter(application_delivery_controller_object_filter) unless application_delivery_controller_object_filter.empty?
   = .object_mask("mask[id]")

  application_delivery_controller_data = .getApplicationDeliveryControllers
  software_passwords                   = application_delivery_controller_data.collect do |application_delivery_controller|
    application_delivery_controller_service = softlayer_client[:Network_Application_Delivery_Controller].object_with_id(application_delivery_controller['id'])
    application_delivery_controller_service = application_delivery_controller_service.object_filter(software_password_object_filter) unless software_password_object_filter.empty?
    application_delivery_controller_service = application_delivery_controller_service.object_mask(SoftwarePassword.default_object_mask)
    application_delivery_controller_service = application_delivery_controller_service.object_mask(options_hash[:software_password_object_mask]) if options_hash[:software_password_object_mask]

    software_password_data = application_delivery_controller_service.getPassword
    SoftwarePassword.new(softlayer_client, software_password_data) unless software_password_data.empty?
  end

  software_passwords.compact
end

.find_passwords_for_software_on_hardware(options_hash = {}) ⇒ Object

Retrieve a list of software passwords from software on hardware devices.

The options parameter should contain:

:client - The client used to connect to the API

If no client is given, then the routine will try to use Client.default_client If no client can be found the routine will raise an error.

You may filter the list returned by adding options:

  • :datacenter (string/array) - Include software passwords from software on hardware matching this datacenter

  • :description (string/array) - Include software passwords from software that matches this description

  • :domain (string/array) - Include software passwords from software on hardware matching this domain

  • :hardware_type (symbol) - Include software passwords from software on hardware matching this hardware type

  • :hostname (string/array) - Include software passwords from software on hardware matching this hostname

  • :manufacturer (string/array) - Include software passwords from software that matches this manufacturer

  • :name (string/array) - Include software passwords from software that matches this name

  • :username (string/array) - Include software passwords for username matching this username

You may use the following properties to provide hardware or software object filter instances:

  • :hardware_object_filter (ObjectFilter) - Include software passwords from software on hardware that matches the criteria of this object filter

  • :software_object_filter (ObjectFilter) - Include software passwords from software that matches the criteria of this object filter

  • +:software_password_object_filter* (ObjectFilter) - Include software passwords that match the criteria of this object filter

  • :software_password_object_mask (string) - Include software password properties that matches the criteria of this object mask



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/softlayer/SoftwarePassword.rb', line 317

def self.find_passwords_for_software_on_hardware(options_hash = {})
  softlayer_client = options_hash[:client] || Client.default_client
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client

  if(options_hash.has_key? :hardware_object_filter)
    hardware_object_filter = options_hash[:hardware_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless hardware_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    hardware_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :software_object_filter)
    software_object_filter = options_hash[:software_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless software_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    software_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :software_password_object_filter)
    software_password_object_filter = options_hash[:software_password_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless software_password_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    software_password_object_filter = ObjectFilter.new()
  end

  filter_label = {
    :bare_metal_instance => "bareMetalInstances",
    :hardware            => "hardware",
    :network_hardware    => "networkHardware",
    :router              => "routers"
  }

  option_to_filter_path = {
    :hardware          => {
      :datacenter        => lambda { |hardware_type| return [ filter_label[hardware_type], '.datacenter.name' ].join        },
      :domain            => lambda { |hardware_type| return [ filter_label[hardware_type], '.domain' ].join                 },
      :hostname          => lambda { |hardware_type| return [ filter_label[hardware_type], '.hostname' ].join               },
      :tags              => lambda { |hardware_type| return [ filter_label[hardware_type], '.tagReferences.tag.name' ].join }
    },
    :software          => {
      :description     => "softwareComponents.softwareDescription.longDescription",
      :manufacturer    => "softwareComponents.softwareDescription.manufacturer",
      :name            => "softwareComponents.softwareDescription.name",
      :username        => "softwareComponents.passwords.username"
    },
    :software_password => {
      :username        => "passwords.username"
    }
  }

  if options_hash[:hardware_type]
    unless filter_label.keys.include?(options_hash[:hardware_type])
      raise "Expected :bare_metal_instance, :hardware, :network_hardware, or :router for option :hardware_type in #{__method__}"
    end
  end

  option_to_filter_path[:hardware].keys.each do |option|
    if options_hash[option]
      hardware_object_filter.modify { |filter| filter.accept(option_to_filter_path[:hardware][option].call(options_hash[:hardware_type] || :hardware)).when_it is(options_hash[option]) }
    end
  end

  option_to_filter_path[:software].each do |option, filter_path|
    software_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

  option_to_filter_path[:software_password].each do |option, filter_path|
    software_password_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

   = softlayer_client[:Account]
   = .object_filter(hardware_object_filter) unless hardware_object_filter.empty?
   = .object_mask("mask[id]")

  case options_hash[:hardware_type]
  when :bare_metal_instance
    hardware_data = .getBareMetalInstances
  when :hardware, nil
    hardware_data = .getHardware
  when :network_hardware
    hardware_data = .getNetworkHardware
  when :router
    hardware_data = .getRouters
  end

  software_passwords = hardware_data.collect do |hardware|
    hardware_service = softlayer_client[:Hardware].object_with_id(hardware['id'])
    hardware_service = hardware_service.object_filter(software_object_filter) unless software_object_filter.empty?
    hardware_service = hardware_service.object_mask("mask[id]")

    software_data    = hardware_service.getSoftwareComponents

    software_data.collect do |software|
      next if software.empty?

      software_service = softlayer_client[:Software_Component].object_with_id(software['id'])
      software_service = software_service.object_filter(software_password_object_filter) unless software_password_object_filter.empty?
      software_service = software_service.object_mask(SoftwarePassword.default_object_mask)
      software_service = software_service.object_mask(options_hash[:software_password_object_mask]) if options_hash[:software_password_object_mask]

      software_passwords_data = software_service.getPasswords
      software_passwords_data.map { |password| SoftwarePassword.new(softlayer_client, password) unless password.empty? }.compact
    end
  end

  software_passwords.flatten
end

.find_passwords_for_software_on_virtual_servers(options_hash = {}) ⇒ Object

Retrieve a list of software passwords from software virtual servers.

The options parameter should contain:

:client - The client used to connect to the API

If no client is given, then the routine will try to use Client.default_client If no client can be found the routine will raise an error.

You may filter the list returned by adding options:

  • :datacenter (string/array) - Include software passwords from software on virtual servers matching this datacenter

  • :description (string/array) - Include software passwords from software that matches this description

  • :domain (string/array) - Include software passwords from software on virtual servers matching this domain

  • :hostname (string/array) - Include software passwords from software on virtual servers matching this hostname

  • :manufacturer (string/array) - Include software passwords from software that matches this manufacturer

  • :name (string/array) - Include software passwords from software that matches this name

  • :username (string/array) - Include software passwords for username matching this username

You may use the following properties to provide virtual server or software object filter instances:

  • :virtual_server_object_filter (ObjectFilter) - Include software passwords from software on virtual servers that matches the criteria of this object filter

  • :software_object_filter (ObjectFilter) - Include software passwords from softwarethat matches the criteria of this object filter

  • +:software_password_object_filter* (ObjectFilter) - Include software passwords that match the criteria of this object filter

  • :software_password_object_mask (string) - Include software password properties that matches the criteria of this object mask



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
# File 'lib/softlayer/SoftwarePassword.rb', line 450

def self.find_passwords_for_software_on_virtual_servers(options_hash = {})
  softlayer_client = options_hash[:client] || Client.default_client
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client

  if(options_hash.has_key? :virtual_server_object_filter)
    virtual_server_object_filter = options_hash[:virtual_server_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless virtual_server_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    virtual_server_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :software_object_filter)
    software_object_filter = options_hash[:software_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless software_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    software_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :software_password_object_filter)
    software_password_object_filter = options_hash[:software_password_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless software_password_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    software_password_object_filter = ObjectFilter.new()
  end

  option_to_filter_path = {
    :software          => {
      :description     => "softwareComponents.softwareDescription.longDescription",
      :manufacturer    => "softwareComponents.softwareDescription.manufacturer",
      :name            => "softwareComponents.softwareDescription.name",
      :username        => "softwareComponents.passwords.username"
    },
    :virtual_server    => {
      :datacenter      => "virtualGuests.datacenter.name",
      :domain          => "virtualGuests.domain",
      :hostname        => "virtualGuests.hostname",
      :tags            => "virtualGuests.tagReferences.tag.name"
    },
    :software_password => {
      :username        => "passwords.username"
    }
  }

  option_to_filter_path[:virtual_server].each do |option, filter_path|
    virtual_server_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

  option_to_filter_path[:software].each do |option, filter_path|
    software_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

  option_to_filter_path[:software_password].each do |option, filter_path|
    software_password_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

   = softlayer_client[:Account]
   = .object_filter(virtual_server_object_filter) unless virtual_server_object_filter.empty?
   = .object_mask("mask[id]")

  virtual_server_data = .getVirtualGuests

  software_passwords = virtual_server_data.collect do |virtual_server|
    virtual_server_service = softlayer_client[:Virtual_Guest].object_with_id(virtual_server['id'])
    virtual_server_service = virtual_server_service.object_filter(software_object_filter) unless software_object_filter.empty?
    virtual_server_service = virtual_server_service.object_mask("mask[id]")

    software_data          = virtual_server_service.getSoftwareComponents
    software_data.collect do |software| 
      next if software.empty?

      software_service = softlayer_client[:Software_Component].object_with_id(software['id'])
      software_service = software_service.object_filter(software_password_object_filter) unless software_password_object_filter.empty?
      software_service = software_service.object_mask(SoftwarePassword.default_object_mask)
      software_service = software_service.object_mask(options_hash[:software_password_object_mask]) if options_hash[:software_password_object_mask]

      software_passwords_data = software_service.getPasswords
      software_passwords_data.map { |password| SoftwarePassword.new(softlayer_client, password) unless password.empty? }.compact
    end
  end

  software_passwords.flatten
end

.find_passwords_for_vlan_firewalls(options_hash = {}) ⇒ Object

Retrieve a list of software passwords from vlan firewalls management credentials.

The options parameter should contain:

:client - The client used to connect to the API

If no client is given, then the routine will try to use Client.default_client If no client can be found the routine will raise an error.

You may filter the list returned by adding options:

  • :datacenter (string/array) - Include software passwords from vlan firewalls matching this datacenter

  • :vlan_names (string/array) - Include software passwords from vlans that matches these names

  • :vlan_numbers (string/array) - Include software passwords from vlans that matches these numbers

  • :vlan_space (symbol) - Include software passwords from vlans that match this space

  • :vlan_tags (string/array) - Include software passwords from vlans that matches these tags

  • :vlan_fw_fqdn (string/array) - Include software passwords from vlan firewalls that match this fqdn

  • :vlan_fw_tags (string/array) - Include software passwords from vlan firewalls that matches these tags

  • :vlan_fw_type (string/array) - Include software passwords from vlan firewalls that match this type

  • :username (string/array) - Include software passwords that match this username

Additionally you may provide options related to the request itself:

  • :software_password_object_filter (ObjectFilter) - Include software passwords that match the criteria of this object filter

  • :software_password_object_mask (string) - The object mask of properties you wish to receive for the items returned.

    If not provided, the result will use the default object mask
    
  • :vlan_firewall_object_filter (ObjectFilter) - Include software passwords from vlan firewalls that match the

    criteria of this object filter
    
  • :vlan_object_filter (ObjectFilter) - Include software passwords from vlan firewalls whose vlans match the

    criteria of this object filter
    


186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/softlayer/SoftwarePassword.rb', line 186

def self.find_passwords_for_vlan_firewalls(options_hash = {})
  softlayer_client = options_hash[:client] || Client.default_client
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client

  if(options_hash.has_key? :vlan_object_filter)
    vlan_object_filter = options_hash[:vlan_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless vlan_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    vlan_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :vlan_firewall_object_filter)
    vlan_firewall_object_filter = options_hash[:vlan_firewall_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless vlan_firewall_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    vlan_firewall_object_filter = ObjectFilter.new()
  end

  if(options_hash.has_key? :software_password_object_filter)
    software_password_object_filter = options_hash[:software_password_object_filter]
    raise "Expected an instance of SoftLayer::ObjectFilter" unless software_password_object_filter.kind_of?(SoftLayer::ObjectFilter)
  else
    software_password_object_filter = ObjectFilter.new()
  end

  filter_label = {
    :all     => 'networkVlans',
    :private => 'privateNetworkVlans',
    :public  => 'publicNetworkVlans'
  }

  option_to_filter_path = {
    :software_password => {
      :username        => "managementCredentials.username"
      },
    :vlan              => {
      :vlan_dedicated_fw => lambda { |vlan_space| return [ filter_label[vlan_space], '.', 'dedicatedFirewallFlag' ].join  },
      :vlan_names        => lambda { |vlan_space| return [ filter_label[vlan_space], '.', 'name' ].join                   },
      :vlan_numbers      => lambda { |vlan_space| return [ filter_label[vlan_space], '.', 'vlanNumber' ].join             },
      :vlan_tags         => lambda { |vlan_space| return [ filter_label[vlan_space], '.', 'tagReferences.tag.name' ].join }
    },
    :vlan_firewall     => {
      :vlan_fw_datacenter => "networkVlanFirewall.datacenter.name",
      :vlan_fw_fqdn       => "networkVlanFirewall.fullyQualifiedDomainName",
      :vlan_fw_tags       => "networkVlanFirewall.tagReferences.tag.name",
      :vlan_fw_type       => "networkVlanFirewall.firewallType"
    }
  }

  if options_hash[:vlan_space] && ! filter_label.keys.include?(options_hash[:vlan_space])
    raise "Expected one of :all, :private, or :public for option :vlan_space in #{__method__}"
  end

  option_to_filter_path[:software_password].each do |option, filter_path|
    software_password_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

  vlan_space = options_hash[:vlan_space] || :all

  option_to_filter_path[:vlan].keys.each do |option|
    vlan_object_filter.modify { |filter| filter.accept(option_to_filter_path[:vlan][option].call(vlan_space)).when_it is(1) } if option == :vlan_dedicated_fw

    if options_hash[option] && option != :vlan_dedicated_fw
      vlan_object_filter.modify { |filter| filter.accept(option_to_filter_path[:vlan][option].call(vlan_space)).when_it is(options_hash[option]) }
    end
  end

  option_to_filter_path[:vlan_firewall].each do |option, filter_path|
    vlan_firewall_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
  end

   = softlayer_client[:Account]
   = .object_filter(vlan_object_filter) unless vlan_object_filter.empty?
   = .object_mask("mask[id]")

  case vlan_space
  when :all
    vlan_data = .getNetworkVlans
  when :private
    vlan_data = .getPrivateNetworkVlans
  when :public
    vlan_data = .getPublicNetworkVlans
  end

  vlan_fw_passwords = vlan_data.collect do |vlan|
    vlan_service = softlayer_client[:Network_Vlan].object_with_id(vlan['id'])
    vlan_service = vlan_service.object_filter(vlan_firewall_object_filter) unless vlan_firewall_object_filter.empty?
    vlan_service = vlan_service.object_mask("mask[id]")

    vlan_fw = vlan_service.getNetworkVlanFirewall

    unless vlan_fw.empty?
      vlan_fw_service = softlayer_client[:Network_Vlan_Firewall].object_with_id(vlan_fw['id'])
      vlan_fw_service = vlan_fw_service.object_filter(software_password_object_filter) unless software_password_object_filter.empty?
      vlan_fw_service = vlan_fw_service.object_mask(SoftwarePassword.default_object_mask)
      vlan_fw_service = vlan_fw_service.object_mask(options_hash[:software_password_object_mask]) if options_hash[:software_password_object_mask]

      vlan_fw_password_data = vlan_fw_service.getManagementCredentials
      SoftwarePassword.new(softlayer_client, vlan_fw_password_data) unless vlan_fw_password_data.empty?
    end
  end

  vlan_fw_passwords.compact
end

.update_passwords(passwords, password, options_hash = {}) ⇒ Object

Update the passwords for a list of software passwords

The options parameter should contain:

:client - The client used to connect to the API

If no client is given, then the routine will try to use Client.default_client If no client can be found the routine will raise an error.

Raises:

  • (ArgumentError)


543
544
545
546
547
548
549
550
551
552
553
554
555
556
# File 'lib/softlayer/SoftwarePassword.rb', line 543

def self.update_passwords(passwords, password, options_hash = {})
  softlayer_client = options_hash[:client] || Client.default_client
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client

  raise ArgumentError, "The new password cannot be nil"   unless password
  raise ArgumentError, "The new password cannot be empty" if password.empty?

  if ! passwords.kind_of?(Array) || ! passwords.select { |password| ! password.kind_of?(SoftLayer::SoftwarePassword) }.empty?
    raise ArgumentError, "Expected an array of SoftLayer::SoftwarePassword instances"
  end

  software_password_service = softlayer_client[:Software_Component_Password]
  software_password_service.editObjects(passwords.map { |pw| { 'id' => pw['id'], 'password' => password.to_s } })
end

Instance Method Details

#createdObject

:attr_reader: created The date this username/password pair was created. DEPRECATION WARNING: This attribute is deprecated in favor of created_at and will be removed in the next major release.



28
# File 'lib/softlayer/SoftwarePassword.rb', line 28

sl_attr :created, 'createDate'

#created_atObject

:attr_reader: created_at The date this username/password pair was created.



21
# File 'lib/softlayer/SoftwarePassword.rb', line 21

sl_attr :created_at, 'createDate'

#modifiedObject

:attr_reader: modified The date of the last modification to this username/password pair. DEPRECATION WARNING: This attribute is deprecated in favor of modified_at and will be removed in the next major release.



40
# File 'lib/softlayer/SoftwarePassword.rb', line 40

sl_attr :modified, 'modifyDate'

#modified_atObject

:attr_reader: modified_at The date of the last modification to this username/password pair.



33
# File 'lib/softlayer/SoftwarePassword.rb', line 33

sl_attr :modified_at, 'modifyDate'

#notesObject

:attr_reader: A note string stored for this username/password pair.



45
# File 'lib/softlayer/SoftwarePassword.rb', line 45

sl_attr :notes

#passwordObject

:attr_reader: The password part of the username/password pair.



50
# File 'lib/softlayer/SoftwarePassword.rb', line 50

sl_attr :password

#password=(password) ⇒ Object

Updates the password for the current software user.

Raises:

  • (ArgumentError)


63
64
65
66
67
68
69
# File 'lib/softlayer/SoftwarePassword.rb', line 63

def password=(password)
  raise ArgumentError, "The new password cannot be nil"   unless password
  raise ArgumentError, "The new password cannot be empty" if password.empty?

  self.service.editObject({ "password" => password.to_s })
  self.refresh_details()
end

#portObject

:attr_reader:



54
# File 'lib/softlayer/SoftwarePassword.rb', line 54

sl_attr :port

#serviceObject

Returns the service for interacting with this software component password through the network API



561
562
563
# File 'lib/softlayer/SoftwarePassword.rb', line 561

def service
  softlayer_client[:Software_Component_Password].object_with_id(self.id)
end

#softlayer_properties(object_mask = nil) ⇒ Object

Make an API request to SoftLayer and return the latest properties hash for this object.



569
570
571
572
573
574
575
576
577
578
579
# File 'lib/softlayer/SoftwarePassword.rb', line 569

def softlayer_properties(object_mask = nil)
  my_service = self.service

  if(object_mask)
    my_service = my_service.object_mask(object_mask)
  else
    my_service = my_service.object_mask(self.class.default_object_mask)
  end

  my_service.getObject()
end

#usernameObject

The username part of the username/password pair.



58
# File 'lib/softlayer/SoftwarePassword.rb', line 58

sl_attr :username