Class: SoftLayer::NetworkService

Inherits:
ModelBase show all
Includes:
DynamicAttribute
Defined in:
lib/softlayer/NetworkService.rb

Overview

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.

Instance Attribute Summary

Attributes inherited from ModelBase

#softlayer_client

Instance Method Summary collapse

Methods included from DynamicAttribute

included

Methods inherited from ModelBase

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

Constructor Details

This class inherits a constructor from SoftLayer::ModelBase

Instance Method Details

#apiObject

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



56
57
58
59
60
61
62
63
64
65
# 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

#datacenterObject

Retrieve the datacenter that this network service resource is available in :call-seq:

datacenter(force_update=false)


42
43
44
45
46
47
48
49
50
51
# 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

#nameObject

:attr_reader: The name associated with this resource



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

sl_attr :name

#private_ipObject

:attr_reader: private_ip The backend IP address for this resource



26
# File 'lib/softlayer/NetworkService.rb', line 26

sl_attr :private_ip,   'backendIpAddress'

#public_ipObject

:attr_reader: public_ip The frontend IP address for this resource



31
# File 'lib/softlayer/NetworkService.rb', line 31

sl_attr :public_ip,    'frontendIpAddress'

#ssh_usernameObject

:attr_reader: ssh_username The ssh username of for this resource



36
# File 'lib/softlayer/NetworkService.rb', line 36

sl_attr :ssh_username, 'sshUsername'

#typeObject

Returns the network service resource type name



70
71
72
# File 'lib/softlayer/NetworkService.rb', line 70

def type
  self['type']['type']
end