|
| 1 | +from click import command, argument, option |
| 2 | +import cloudinary.provisioning |
| 3 | + |
| 4 | +from cloudinary_cli.utils.api_utils import handle_api_command |
| 5 | + |
| 6 | + |
| 7 | +@command("provisioning", |
| 8 | + short_help="Run any methods that can be called through the provisioning API.", |
| 9 | + help="""\b |
| 10 | +Run any methods that can be called through the provisioning API. |
| 11 | +Format: cld <cli options> provisioning <command options> <method> <method parameters> |
| 12 | +\te.g. cld provisioning sub_accounts |
| 13 | +""") |
| 14 | +@argument("params", nargs=-1) |
| 15 | +@option("-o", "--optional_parameter", multiple=True, nargs=2, help="Pass optional parameters as raw strings.") |
| 16 | +@option("-O", "--optional_parameter_parsed", multiple=True, nargs=2, |
| 17 | + help="Pass optional parameters as interpreted strings.") |
| 18 | +@option("-ls", "--ls", is_flag=True, help="List all available methods in the Provisioning API.") |
| 19 | +@option("--save", nargs=1, help="Save output to a file.") |
| 20 | +@option("-d", "--doc", is_flag=True, help="Open the Provisioning API reference in a browser.") |
| 21 | +def provisioning(params, optional_parameter, optional_parameter_parsed, ls, save, doc): |
| 22 | + return handle_api_command(params, optional_parameter, optional_parameter_parsed, ls, save, doc, |
| 23 | + doc_url="https://cloudinary.com/documentation/provisioning_api", |
| 24 | + api_instance=cloudinary.provisioning, |
| 25 | + api_name="provisioning") |
0 commit comments