Class: SoftLayer::NetworkStorageGroup

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

Overview

Each SoftLayer NetworkStorageGroup instance provides information about a storage product group and hosts allowed access.

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

#accountObject

The SoftLayer_Account which owns this group.


29
30
31
32
33
34
35
36
37
38
39
# File 'lib/softlayer/NetworkStorageGroup.rb', line 29

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

  resource.to_update do
     = self.service.getAccount
    Account.new(softlayer_client, ) unless .empty?
  end
end

#aliasObject

:attr_reader: The friendly name of this group


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

sl_attr :alias

#allowed_hostsObject

The allowed hosts list for this group.


43
44
45
46
47
48
49
50
51
52
53
# File 'lib/softlayer/NetworkStorageGroup.rb', line 43

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

  resource.to_update do
    allowed_hosts = self.service.object_mask(NetworkStorageAllowedHost.default_object_mask).getAllowedHosts
    allowed_hosts.collect { |allowed_host| NetworkStorageAllowedHost.new(softlayer_client, allowed_host) unless allowed_host.empty? }.compact
  end
end

#attached_volumesObject

The network storage volumes this group is attached to.


57
58
59
60
61
62
63
64
65
66
67
# File 'lib/softlayer/NetworkStorageGroup.rb', line 57

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

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

#createdObject

:attr_reader: The date this group was created.


20
# File 'lib/softlayer/NetworkStorageGroup.rb', line 20

sl_attr :created, 'createDate'

#ip_addressObject

The IP address for for SoftLayer_Network_Storage_Allowed_Host objects within this group.


71
72
73
74
75
76
77
78
79
80
81
# File 'lib/softlayer/NetworkStorageGroup.rb', line 71

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

  resource.to_update do
    network_connection_details = self.service.getNetworkConnectionDetails
    network_connection_details["ipAddress"] unless network_connection_details.empty?
  end
end

#modifiedObject

:attr_reader: The date this group was modified.


25
# File 'lib/softlayer/NetworkStorageGroup.rb', line 25

sl_attr :modified, 'modifyDate'

#os_descriptionObject

The description of theSoftLayer_Network_Storage_OS_Type Operating System designation that this group was created for.


85
86
87
88
89
90
91
92
93
94
95
# File 'lib/softlayer/NetworkStorageGroup.rb', line 85

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

  resource.to_update do
    os_type = self.service.getOsType
    os_type["description"] unless os_type.empty?
  end
end

#os_nameObject

The name of theSoftLayer_Network_Storage_OS_Type Operating System designation that this group was created for.


99
100
101
102
103
104
105
106
107
108
109
# File 'lib/softlayer/NetworkStorageGroup.rb', line 99

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

  resource.to_update do
    os_type = self.service.getOsType
    os_type["name"] unless os_type.empty?
  end
end

#serviceObject

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


142
143
144
# File 'lib/softlayer/NetworkStorageGroup.rb', line 142

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

#service_resourceObject

The network resource this group is created on.


113
114
115
116
117
118
119
120
121
122
123
# File 'lib/softlayer/NetworkStorageGroup.rb', line 113

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

  resource.to_update do
    service_resource = self.service.object_mask(NetworkService.default_object_mask).getServiceResource
    NetworkService.new(softlayer_client, service_resource) unless service_resource.empty?
  end
end

#typeObject

The name of the SoftLayer_Network_Storage_Group_Type which describes this group.


127
128
129
130
131
132
133
134
135
136
137
# File 'lib/softlayer/NetworkStorageGroup.rb', line 127

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

  resource.to_update do
    group_type = self.service.getGroupType
    group_type["name"]
  end
end