diff --git a/client-cli/cli_lib/provisioner.py b/client-cli/cli_lib/provisioner.py index eb4001d9..bbd6847f 100644 --- a/client-cli/cli_lib/provisioner.py +++ b/client-cli/cli_lib/provisioner.py @@ -189,6 +189,21 @@ def userdata_list(config, limit): else: return False, response.json()['message'] +def userdata_show(config, name): + """ + Get information about userdata name + + API endpoint: GET /api/v1/provisioner/userdata/{name} + API arguments: + API schema: [{json_data_object},{json_data_object},etc.] + """ + response = call_api(config, 'get', '/provisioner/userdata/{}'.format(name)) + + if response.status_code == 200: + return True, response.json()[0]['userdata'] + else: + return False, response.json()['message'] + def userdata_add(config, params): """ Add a new userdata with {params} @@ -291,6 +306,21 @@ def script_list(config, limit): else: return False, response.json()['message'] +def script_show(config, name): + """ + Get information about script name + + API endpoint: GET /api/v1/provisioner/script/{name} + API arguments: + API schema: [{json_data_object},{json_data_object},etc.] + """ + response = call_api(config, 'get', '/provisioner/script/{}'.format(name)) + + if response.status_code == 200: + return True, response.json()[0]['script'] + else: + return False, response.json()['message'] + def script_add(config, params): """ Add a new script with {params} diff --git a/client-cli/pvc.py b/client-cli/pvc.py index 1ada8592..872243bd 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -2678,6 +2678,20 @@ def provisioner_userdata_list(limit, full): retdata = pvc_provisioner.format_list_userdata(retdata, lines) cleanup(retcode, retdata) +############################################################################### +# pvc provisioner userdata show +############################################################################### +@click.command(name='show', short_help='Show contents of userdata documents.') +@click.argument( + 'name' +) +def provisioner_userdata_show(name): + """ + Show the full contents of userdata document NAME. + """ + retcode, retdata = pvc_provisioner.userdata_show(config, name) + cleanup(retcode, retdata) + ############################################################################### # pvc provisioner userdata add ############################################################################### @@ -2836,6 +2850,20 @@ def provisioner_script_list(limit, full): retdata = pvc_provisioner.format_list_script(retdata, lines) cleanup(retcode, retdata) +############################################################################### +# pvc provisioner script show +############################################################################### +@click.command(name='show', short_help='Show contents of script documents.') +@click.argument( + 'name' +) +def provisioner_script_show(name): + """ + Show the full contents of script document NAME. + """ + retcode, retdata = pvc_provisioner.script_show(config, name) + cleanup(retcode, retdata) + ############################################################################### # pvc provisioner script add ############################################################################### @@ -3578,11 +3606,13 @@ provisioner_template.add_command(provisioner_template_storage) provisioner_template.add_command(provisioner_template_list) provisioner_userdata.add_command(provisioner_userdata_list) +provisioner_userdata.add_command(provisioner_userdata_show) provisioner_userdata.add_command(provisioner_userdata_add) provisioner_userdata.add_command(provisioner_userdata_modify) provisioner_userdata.add_command(provisioner_userdata_remove) provisioner_script.add_command(provisioner_script_list) +provisioner_script.add_command(provisioner_script_show) provisioner_script.add_command(provisioner_script_add) provisioner_script.add_command(provisioner_script_modify) provisioner_script.add_command(provisioner_script_remove)