Class: SoftLayer::NetworkStorageAllowedHost

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

Overview

Each SoftLayer NetworkStorageAllowedHost instance provides information about a hosts allowed access to a storage product group.

This class roughly corresponds to the entity SoftLayer_Network_Storage_Group 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, sl_attr, #to_ary

Constructor Details

This class inherits a constructor from SoftLayer::ModelBase

Instance Method Details

#assigned_groupsObject

The NetworkStorageGroup instances assigned to this host



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/softlayer/NetworkStorageAllowedHost.rb', line 19

sl_dynamic_attr :assigned_groups do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @assigned_groups == nil
  end

  resource.to_update do
    assigned_groups = self.service.object_mask(NetworkStorageGroup.default_object_mask).getAssignedGroups
    assigned_groups.collect { |assigned_group| NetworkStorageGroup.new(softlayer_client, assigned_group) unless assigned_group.empty? }.compact
  end
end

#assigned_volumesObject

The NetworkStorage instances assigned to this host



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/softlayer/NetworkStorageAllowedHost.rb', line 33

sl_dynamic_attr :assigned_volumes do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @assigned_volumes == nil
  end

  resource.to_update do
    assigned_volumes = self.service.object_mask(NetworkStorage.default_object_mask).getAssignedVolumes
    assigned_volumes.collect { |assigned_volume| NetworkStorage.new(softlayer_client, assigned_volume) unless assigned_volume.empty? }.compact
  end
end

#credentialObject

The NetworkStorageCredential instance used to access NetworkStorage for this host



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/softlayer/NetworkStorageAllowedHost.rb', line 47

sl_dynamic_attr :credential do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @credential == nil
  end

  resource.to_update do
    credential = self.service.object_mask(NetworkStorageCredential.default_object_mask).getCredential
    NetworkStorageCredential.new(softlayer_client, credential) unless credential.empty?
  end
end

#nameObject

:attr_reader: The name of allowed host, usually an IQN or other identifier



15
# File 'lib/softlayer/NetworkStorageAllowedHost.rb', line 15

sl_attr :name

#serviceObject

Returns the service for interacting with this network storage through the network API



62
63
64
# File 'lib/softlayer/NetworkStorageAllowedHost.rb', line 62

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