-
Notifications
You must be signed in to change notification settings - Fork 194
Fix order place quantity option #1119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix order place quantity option #1119
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just make sure the default quantity option is 1 so this change doesn't break any code that doesn't explicitly set the quantity.
SoftLayer/managers/ordering.py
Outdated
|
||
def generate_order(self, package_keyname, location, item_keynames, complex_type=None, | ||
hourly=True, preset_keyname=None, extras=None, quantity=1): | ||
hourly=True, preset_keyname=None, extras=None, quantity=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say leave this as quantity=1
that way you can just leave order['quantity'] = quantity
and can avoid the extra if statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
help="Flag denoting whether or not to only verify the order, not place it") | ||
@click.option('--quantity', | ||
type=int, | ||
help="The quantity of the item being ordered") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a default of 1 here, so users just ordering 1 item don't have to specify that option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Fix order place quantity option #1116.
>slcli order place --help
Example1:
>slcli order place --quantity 2 --billing monthly VIRTUAL_ROUTER_APPLIANCE_1_GPBS DALLAS05 INTEL_INTEL_XEON_E31270_V6_3_80 OS_JUNIPER_VSRX_15_X_UP_TO_1GBPS_STANDARD RAM_32_GB_DDR4_2133_ECC_NON_REG DISK_CONTROLLER_RAID HARD_DRIVE_3_00TB_SATA_III SRIOV_ENABLED BANDWIDTH_5000_GB MONITORING_HOST_PING 1_GBPS_REDUNDANT_PUBLIC_PRIVATE_NETWORK_UPLINKS REBOOT_KVM_OVER_IP 1_IP_ADDRESS NOTIFICATION_EMAIL_AND_TICKET AUTOMATED_NOTIFICATION UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT NESSUS_VULNERABILITY_ASSESSMENT_REPORTING --complex-type SoftLayer_Container_Product_Order_Hardware_Server_Gateway_Appliance --extras '{"hardware":[{"hostname":"gateway01","domain":"example.com"},{"hostname":"gateway02","domain":"example.com"}]}'
Output:
:...................................................................................:
: name : value :
:...................................................................................:
: id : 35311111 :
: created : 2019-03-19T10:04:09-06:00 :
: status : PENDING_AUTO_APPROVAL :
:....................................................................................
Example2:
By default the quantity is 1:
>slcli order place --billing monthly VIRTUAL_ROUTER_APPLIANCE_1_GPBS DALLAS05 INTEL_INTEL_XEON_E31270_V6_3_80 OS_JUNIPER_VSRX_15_X_UP_TO_1GBPS_STANDARD RAM_32_GB_DDR4_2133_ECC_NON_REG DISK_CONTROLLER_RAID HARD_DRIVE_3_00TB_SATA_III SRIOV_ENABLED BANDWIDTH_5000_GB MONITORING_HOST_PING 1_GBPS_REDUNDANT_PUBLIC_PRIVATE_NETWORK_UPLINKS REBOOT_KVM_OVER_IP 1_IP_ADDRESS NOTIFICATION_EMAIL_AND_TICKET AUTOMATED_NOTIFICATION UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT NESSUS_VULNERABILITY_ASSESSMENT_REPORTING --complex-type SoftLayer_Container_Product_Order_Hardware_Server_Gateway_Appliance --extras '{"hardware":[{"hostname":"gateway01","domain":"example.com"}]}'
Output:
:...................................................................................:
: name : value :
:...................................................................................:
: id : 35322222 :
: created : 2019-03-19T11:08:14-06:00 :
: status : PENDING_AUTO_APPROVAL :
:....................................................................................
Example3:
ORDER CLOUD_SERVER:
>slcli order place --quantity 2 --billing hourly CLOUD_SERVER AMSTERDAM GUEST_PRIVATE_CORE_1 RAM_2_GB OS_CENTOS_7_X_MINIMAL_64_BIT GUEST_DISK_25_GB_SAN BANDWIDTH_0_GB_2 1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS MONITORING_HOST_PING AUTOMATED_NOTIFICATION UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT NESSUS_VULNERABILITY_ASSESSMENT_REPORTING 1_IP_ADDRESS NOTIFICATION_EMAIL_AND_TICKET REBOOT_REMOTE_CONSOLE --extras "{"privateCloudOrderFlag":false,"useHourlyPricing":true,""virtualGuests": [{"hostname": "test", "domain": "softlayer.com"},{"hostname": "test1", "domain": "softlayer.com"}]}" --complex-type SoftLayer_Container_Product_Order_Virtual_Guest
Output:
:...................................................................................:
: name : value :
:...................................................................................:
: id : 35333333 :
: created : 2019-03-19T11:15:28-06:00 :
: status : PENDING_AUTO_APPROVAL :
:....................................................................................