November 23, 2017


# Attach portal storage
# Important manual pages
require 'softlayer_api'
require 'pp'

# Your SoftLayer API username and key.
USERNAME = 'set me'
API_KEY = 'set me'

# The portal storage ID which you wish to attach
image_id = 496_250_6

# The virtual guest Id where you wish to attach the portal storage
virtual_guest_id = 614_303_8

# Declaring the API client to use the SoftLayer_Virtual_Guest API service
client = USERNAME, api_key: API_KEY)
virtual_guest_service = client.service_named('SoftLayer_Virtual_Guest')

  result = virtual_guest_service.object_with_id(virtual_guest_id).attachDiskImage(image_id)
  pp result
rescue StandardError => exception
  puts "Unable to attach the portable storages.  #{exception}"


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue