Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SoftLayer
- import json
- import sys
- parm=sys.argv
- itemId=parm[1]
- # menu
- print (30 * '-')
- print (" M A I N - M E N U")
- print (30 * '-')
- print ("1. Immediate Cancel")
- print ("2. ABD Cancel")
- print (30 * '-')
- # account info
- client = SoftLayer.create_client_from_env()
- Billing = client['SoftLayer_Billing_Item']
- # define option
- is_valid=0
- while not is_valid :
- try :
- choice = int ( raw_input('Enter your choice [1-2] : ') )
- is_valid = 1 ## set it to 1 to validate input and to terminate the while..not loop
- except ValueError, e :
- print ("'%s' is not a valid integer." % e.args[0].split(": ")[1])
- ### Take action as per selected menu-option ###
- if choice == 1:
- print ("Cancelling Immediately...")
- cancel = Billing.cancelItem(True,False,"No longer needed",id=itemId)
- print('Completed!')
- elif choice == 2:
- print ("Configuring ABD Cancellation...")
- cancel = Billing.cancelItem(False,False,"No longer needed",id=itemId)
- print('Completed!')
- else:
- print ("Invalid number. Try again...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement