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



54
55
56
57
58
59
60
61
62
63
# File 'lib/softlayer/NetworkService.rb', line 54

def api
  {
      'host'     => self['apiHost'],
      'password' => self['apiPassword'],
      'path'     => self['apiPath'],
      'port'     => self['apiPort'],
      'protocol' => self['apiProtocol'],
      'username' => self['apiUsername']
  }
end

#datacenterObject

Returns the datacenter that this network service resource is available in



40
41
42
43
44
45
46
47
48
49
# File 'lib/softlayer/NetworkService.rb', line 40

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: The backend IP address for this resource



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

sl_attr :private_ip,   'backendIpAddress'

#public_ipObject

:attr_reader: The frontend IP address for this resource



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

sl_attr :public_ip,    'frontendIpAddress'

#ssh_usernameObject

:attr_reader: 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



68
69
70
# File 'lib/softlayer/NetworkService.rb', line 68

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