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_Allowed_Host 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

Retrieve the NetworkStorageGroup instances assigned to this host :call-seq:

assigned_groups(force_update=false)


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

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

Retrieve the NetworkStorage instances assigned to this host :call-seq:

assigned_volumes(force_update=false)


37
38
39
40
41
42
43
44
45
46
47
# File 'lib/softlayer/NetworkStorageAllowedHost.rb', line 37

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

Retrieve the NetworkStorageCredential instance used to access NetworkStorage for this host :call-seq:

credential(force_update=false)


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

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



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

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