|
5 | 5 | import SoftLayer |
6 | 6 | from SoftLayer.CLI import environment |
7 | 7 | from SoftLayer.CLI import exceptions |
| 8 | +from SoftLayer.CLI import formatting |
8 | 9 |
|
9 | 10 |
|
10 | 11 | CONTEXT_SETTINGS = {'token_normalize_func': lambda x: x.upper()} |
|
26 | 27 | @click.option('--tier', |
27 | 28 | help='Endurance Storage Tier (IOP per GB) [required for storage-type endurance]', |
28 | 29 | type=click.Choice(['0.25', '2', '4', '10'])) |
29 | | -@click.option('--location', |
| 30 | +@click.option('-l', '--location', |
30 | 31 | help='Datacenter short name (e.g.: dal09)', |
31 | 32 | required=True) |
32 | 33 | @click.option('--snapshot-size', |
|
46 | 47 | type=click.Choice(['hourly', 'monthly']), |
47 | 48 | default='monthly', |
48 | 49 | help="Optional parameter for Billing rate (default to monthly)") |
| 50 | +@click.option('--force', default=False, is_flag=True, help="Force order file storage volume without confirmation") |
49 | 51 | @environment.pass_env |
50 | 52 | def cli(env, storage_type, size, iops, tier, |
51 | | - location, snapshot_size, service_offering, billing): |
| 53 | + location, snapshot_size, service_offering, billing, force): |
52 | 54 | """Order a file storage volume. |
53 | 55 |
|
| 56 | + Example:: |
| 57 | + slcli file volume-order --storage-type performance --size 1000 --iops 4000 -d dal09 |
| 58 | + This command orders a performance volume with size is 1000GB, IOPS is 4000, located at dal09. |
| 59 | +
|
| 60 | + slcli file volume-order --storage-type endurance --size 500 --tier 4 -d dal09 --snapshot-size 500 |
| 61 | + This command orders an endurance volume with size is 500GB, tier level is 4 IOPS per GB,\ |
| 62 | +located at dal09 with an additional snapshot space size of 500GB |
| 63 | +
|
54 | 64 | Valid size and iops options can be found here: |
55 | 65 | https://cloud.ibm.com/docs/FileStorage/index.html#provisioning-considerations |
56 | 66 | """ |
57 | 67 | file_manager = SoftLayer.FileStorageManager(env.client) |
58 | 68 | storage_type = storage_type.lower() |
59 | 69 |
|
| 70 | + if not force: |
| 71 | + if not (env.skip_confirmations or |
| 72 | + formatting.confirm("This action will incur charges on your account. Continue?")): |
| 73 | + raise exceptions.CLIAbort('Aborted') |
| 74 | + |
60 | 75 | hourly_billing_flag = False |
61 | 76 | if billing.lower() == "hourly": |
62 | 77 | hourly_billing_flag = True |
|
0 commit comments