class SoftLayer::NetworkService

Each SoftLayer NetworkService instance provides connectivity information for a specific Network Service Resource.

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

Attributes

name[R]

The name associated with this resource

private_ip[R]

The backend IP address for this resource

public_ip[R]

The frontend IP address for this resource

ssh_username[R]

The ssh username of for this resource

Protected Class Methods

default_object_mask() click to toggle source
# File lib/softlayer/NetworkService.rb, line 76
def self.default_object_mask
  {
    "mask(SoftLayer_Network_Service_Resource)" => [
                                                   'apiHost',
                                                   'apiPassword',
                                                   'apiPath',
                                                   'apiPort',
                                                   'apiProtocol',
                                                   'apiUsername',
                                                   'backendIpAddress',
                                                   'datacenter',
                                                   'frontendIpAddress',
                                                   'id',
                                                   'name',
                                                   'networkDevice.id',
                                                   'sshUsername',
                                                   'type.type'
                                                  ]
  }.to_sl_object_mask
end

Public Instance Methods

api() click to toggle source

Returns the api properties used to connect to the network service resource

# File lib/softlayer/NetworkService.rb, line 56
def api
  {
      'host'     => self['apiHost'],
      'password' => self['apiPassword'],
      'path'     => self['apiPath'],
      'port'     => self['apiPort'],
      'protocol' => self['apiProtocol'],
      'username' => self['apiUsername']
  }
end
datacenter(force_update=false) click to toggle source

Retrieve the datacenter that this network service resource is available in

# File lib/softlayer/NetworkService.rb, line 42
sl_dynamic_attr :datacenter do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @datacenter == nil
  end

  resource.to_update do
    Datacenter::datacenter_named(self['datacenter']['name'], self.softlayer_client)
  end
end
type() click to toggle source

Returns the network service resource type name

# File lib/softlayer/NetworkService.rb, line 70
def type
  self['type']['type']
end