Created
December 19, 2012 17:51
-
-
Save underscorephil/4338753 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin perl | |
| use warnings; | |
| use strict; | |
| use Data::Dumper; | |
| use SoftLayer::API::SOAP; | |
| my $api_username = ''; | |
| my $api_key = ''; | |
| my $cPanelIp = '127.0.0.1'; | |
| my $billingItemId; | |
| my $accountId; | |
| my $accountClient = SoftLayer::API::SOAP->new('SoftLayer_Account', undef, $api_username, $api_key); | |
| my $billingClient = SoftLayer::API::SOAP->new('SoftLayer_Billing_Item_Cancellation_Request', undef, $api_username, $api_key); | |
| my $objectMask = "mask.billingItem.id"; | |
| $accountClient->setObjectMask($objectMask); | |
| my $licenses = $accountClient->getActiveVirtualLicenses()->result; | |
| for my $i (0 .. $#{$licenses}) { | |
| my $license = $licenses->[$i]; | |
| if ($cPanelIp eq $license->{'ipAddress'}) { | |
| $billingItemId = $license->{'billingItem'}->{'id'}; | |
| $accountId = $license->{'accountId'}; | |
| } | |
| } | |
| my $cancellationRequestTemplateObject = { | |
| 'items' => [ | |
| { | |
| 'billingItemId' => $billingItemId, | |
| } | |
| ], | |
| 'accountId' => $accountId | |
| }; | |
| my $result = $billingClient->createObject($cancellationRequestTemplateObject); | |
| print Dumper($result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment