@@ -135,6 +135,80 @@ def get_block_volume_snapshot_list(self, volume_id, **kwargs):
135135 return self .client .call ('Network_Storage' , 'getSnapshots' ,
136136 id = volume_id , ** kwargs )
137137
138+ def authorize_host_to_volume (self , volume_id ,
139+ hardware_ids = None ,
140+ virtual_guest_ids = None ,
141+ ip_address_ids = None ):
142+ """Authorizes hosts to Block Storage Volumes
143+
144+ :param volume_id: The Volume to authorize hosts to
145+ :param hardware_ids: A List of SoftLayer_Hardware ids
146+ :param virtual_guest_ids: A List of SoftLayer_Virtual_Guest ids
147+ :param ip_address_ids: A List of SoftLayer_Network_Subnet_IpAddress ids
148+ """
149+ host_templates = []
150+
151+ if hardware_ids is not None :
152+ for hardware_id in hardware_ids :
153+ host_templates .append ({
154+ 'objectType' : 'SoftLayer_Hardware' ,
155+ 'id' : hardware_id
156+ })
157+
158+ if virtual_guest_ids is not None :
159+ for virtual_guest_id in virtual_guest_ids :
160+ host_templates .append ({
161+ 'objectType' : 'SoftLayer_Virtual_Guest' ,
162+ 'id' : virtual_guest_id
163+ })
164+
165+ if ip_address_ids is not None :
166+ for ip_address_id in ip_address_ids :
167+ host_templates .append ({
168+ 'objectType' : 'SoftLayer_Network_Subnet_IpAddress' ,
169+ 'id' : ip_address_id
170+ })
171+
172+ return self .client .call ('Network_Storage' , 'allowAccessFromHostList' ,
173+ host_templates , id = volume_id )
174+
175+ def deauthorize_host_to_volume (self , volume_id ,
176+ hardware_ids = None ,
177+ virtual_guest_ids = None ,
178+ ip_address_ids = None ):
179+ """Revokes authorization of hosts to Block Storage Volumes
180+
181+ :param volume_id: The Volume to deauthorize hosts to
182+ :param hardware_ids: A List of SoftLayer_Hardware ids
183+ :param virtual_guest_ids: A List of SoftLayer_Virtual_Guest ids
184+ :param ip_address_ids: A List of SoftLayer_Network_Subnet_IpAddress ids
185+ """
186+ host_templates = []
187+
188+ if hardware_ids is not None :
189+ for hardware_id in hardware_ids :
190+ host_templates .append ({
191+ 'objectType' : 'SoftLayer_Hardware' ,
192+ 'id' : hardware_id
193+ })
194+
195+ if virtual_guest_ids is not None :
196+ for virtual_guest_id in virtual_guest_ids :
197+ host_templates .append ({
198+ 'objectType' : 'SoftLayer_Virtual_Guest' ,
199+ 'id' : virtual_guest_id
200+ })
201+
202+ if ip_address_ids is not None :
203+ for ip_address_id in ip_address_ids :
204+ host_templates .append ({
205+ 'objectType' : 'SoftLayer_Network_Subnet_IpAddress' ,
206+ 'id' : ip_address_id
207+ })
208+
209+ return self .client .call ('Network_Storage' , 'removeAccessFromHostList' ,
210+ host_templates , id = volume_id )
211+
138212 def delete_snapshot (self , snapshot_id ):
139213 """Deletes the specified snapshot object.
140214
0 commit comments