@@ -86,6 +86,34 @@ def initialize(client, network_hash)
8686 @protected_server = nil
8787 end
8888
89+ ##
90+ # Cancel the firewall
91+ #
92+ # This method cancels the firewall and releases its
93+ # resources. The cancellation is processed immediately!
94+ # Call this method with careful deliberation!
95+ #
96+ # Notes is a string that describes the reason for the
97+ # cancellation. If empty or nil, a default string will
98+ # be added
99+ #
100+ def cancel! ( notes = nil )
101+ user = self . softlayer_client [ :Account ] . object_mask ( "mask[id,account]" ) . getCurrentUser
102+ notes = "Cancelled by a call to #{ __method__ } in the softlayer_api gem" if notes == nil || notes == ""
103+
104+ cancellation_request = {
105+ 'accountId' => user [ 'account' ] [ 'id' ] ,
106+ 'userId' => user [ 'id' ] ,
107+ 'items' => [ {
108+ 'billingItemId' => self [ 'billingItem' ] [ 'id' ] ,
109+ 'immediateCancellationFlag' => true
110+ } ] ,
111+ 'notes' => notes
112+ }
113+
114+ self . softlayer_client [ :Billing_Item_Cancellation_Request ] . createObject ( cancellation_request )
115+ end
116+
89117 ##
90118 # Change the set of rules for the firewall.
91119 # The rules_data parameter should be an array of hashes where
@@ -117,9 +145,9 @@ def change_rules!(rules_data)
117145 # through the firewall. Compare the behavior of this routine with
118146 # change_routing_bypass!
119147 #
120- # It is important to note that changing the bypass to :bypass_firewall_rules
121- # removes ALL the protection offered by the firewall. This routine should be
122- # used with extreme discretion .
148+ # It is important to note that changing the bypass to :bypass_firewall_rules
149+ # removes ALL the protection offered by the firewall. This routine should be
150+ # used with careful deliberation .
123151 #
124152 # Note that this routine queues a rule change and rule changes may take
125153 # time to process. The change will probably not take effect immediately
@@ -205,9 +233,9 @@ def softlayer_properties(object_mask = nil)
205233 service = service . object_mask ( object_mask ) if object_mask
206234
207235 if self . has_sl_property? ( 'networkComponent' )
208- service . object_mask ( "mask[id,status,networkComponent.downlinkComponent.hardwareId]" ) . getObject
236+ service . object_mask ( "mask[id,status,billingItem.id, networkComponent.downlinkComponent.hardwareId]" ) . getObject
209237 else
210- service . object_mask ( "mask[id,status,guestNetworkComponent.guest.id]" ) . getObject
238+ service . object_mask ( "mask[id,status,billingItem.id, guestNetworkComponent.guest.id]" ) . getObject
211239 end
212240 end
213241
@@ -216,7 +244,7 @@ def softlayer_properties(object_mask = nil)
216244 private
217245
218246 def self . network_vlan_mask
219- "mask[firewallNetworkComponents[id,status,networkComponent.downlinkComponent.hardwareId],firewallGuestNetworkComponents[id,status,guestNetworkComponent.guest.id]]"
247+ "mask[firewallNetworkComponents[id,status,billingItem.id, networkComponent.downlinkComponent.hardwareId],firewallGuestNetworkComponents[id,status,billingItem.id ,guestNetworkComponent.guest.id]]"
220248 end
221249
222250 def self . default_rules_mask
0 commit comments