From 0edbcbc4629ea444428a7af4cf73459fa4e24301 Mon Sep 17 00:00:00 2001 From: polatengin Date: Thu, 29 Jun 2023 00:30:35 +0000 Subject: [PATCH 01/23] syncing bicep cli changes to az cli --- .../cli/command_modules/resource/_help.py | 34 +++++++++++++ .../cli/command_modules/resource/_params.py | 21 ++++++++ .../cli/command_modules/resource/commands.py | 2 + .../cli/command_modules/resource/custom.py | 48 ++++++++++++++++++- 4 files changed, 104 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_help.py b/src/azure-cli/azure/cli/command_modules/resource/_help.py index f7532c772cf..a7afb8a4c0c 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_help.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_help.py @@ -2787,6 +2787,20 @@ text: az bicep build --file {bicep_file} --no-restore """ +helps['bicep build-params'] = """ +type: command +short-summary: Build .bicepparam file. +examples: + - name: Build a .bicepparam file. + text: az bicep build --file {bicepparam_file} + - name: Build a .bicepparam file and print all output to stdout. + text: az bicep build --file {bicepparam_file} --stdout + - name: Build a .bicepparam file and save the result to the specified file. + text: az bicep build --file {bicepparam_file} --outfile {out_file} + - name: Build a .bicepparam file without restoring external modules. + text: az bicep build --file {bicepparam_file} --no-restore +""" + helps['bicep format'] = """ type: command short-summary: Format a Bicep file. @@ -2817,6 +2831,24 @@ text: az bicep decompile --file {json_template_file} --force """ +helps['bicep decompile-params'] = """ +type: command +short-summary: Attempts to decompile a parameters .json file to .bicepparam. +examples: + - name: Attempts to decompile a parameters .json file to .bicepparam. + text: az bicep decompile-params --file {json_template_file} + - name: Attempts to decompile a parameters .json file to .bicepparam using the bicep file given. + text: az bicep decompile-params --file {json_template_file} --bicep-file {bicep_file} + - name: Attempts to decompile a parameters .json file to .bicepparam and print all output to stdout. + text: az bicep decompile-params --file {json_template_file} --stdout + - name: Attempts to decompile a parameters .json file to .bicepparam and print all output to stdout and save the result to the specified directory. + text: az bicep decompile-params --file {json_template_file} --outdir {out_dir} + - name: Attempts to decompile a parameters .json file to .bicepparam and print all output to stdout and save the result to the specified file. + text: az bicep decompile-params --file {json_template_file} --outfile {out_file} + - name: Attempts to decompile a parameters .json file to .bicepparam and overwrite existing file. + text: az bicep decompile-params --file {json_template_file} --force +""" + helps['bicep publish'] = """ type: command short-summary: Publish a bicep file to a remote module registry. @@ -3070,6 +3102,8 @@ text: az bicep generate-params --file {bicep_file} --outfile {out_file} - name: Generate parameters file for a Bicep file without restoring external modules. text: az bicep generate-params --file {bicep_file} --no-restore + - name: Generate parameters file for a Bicep file with specified output format. Valid values are ( json | bicepparam ). + text: az bicep generate-params --file {bicep_file} --output-format {output_format} --include-params {include_params} """ helps['resourcemanagement'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 4393e0abfc5..e20226b2ca0 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -806,6 +806,13 @@ def load_arguments(self, _): c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, builds the bicep file without restoring external modules.") + with self.argument_context('bicep build-params') as c: + c.argument('file', arg_type=bicep_file_type, help="The path to the .bicepparam file to build in the file system.") + c.argument('outdir', arg_type=bicep_outdir_type) + c.argument('outfile', arg_type=bicep_outfile_type) + c.argument('stdout', arg_type=bicep_stdout_type) + c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, builds the .bicepparam file without restoring external modules.") + with self.argument_context('bicep format') as c: c.argument('file', arg_type=bicep_file_type, help="The path to the Bicep file to format in the file system.") c.argument('outdir', arg_type=bicep_outdir_type) @@ -820,6 +827,18 @@ def load_arguments(self, _): c.argument('file', arg_type=bicep_file_type, help="The path to the ARM template to decompile in the file system.") c.argument('force', arg_type=bicep_force_type, help="Allows overwriting the output file if it exists.") + with self.argument_context('bicep decompile-params') as c: + c.argument('file', arg_type=bicep_file_type, help="The path to the parameters file to build in the file system.") + c.argument('bicep_file', arg_type=CLIArgumentType(options_list=['--bicep-file', '-bf'], + completer=FilesCompleter(), + type=file_type, + help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.") + ) + c.argument('outdir', arg_type=bicep_outdir_type) + c.argument('outfile', arg_type=bicep_outfile_type) + c.argument('stdout', arg_type=bicep_stdout_type) + c.argument('force', arg_type=bicep_force_type, help="Allows overwriting the output file if it exists.") + with self.argument_context('bicep restore') as c: c.argument('file', arg_type=bicep_file_type, help="The path to the Bicep file to restore external modules for.") c.argument('force', arg_type=bicep_force_type, help="Allows overwriting the cached external modules.") @@ -845,6 +864,8 @@ def load_arguments(self, _): c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") + c.argument('output_format', arg_type=CLIArgumentType(options_list=['--output-format'], help="Set output format. Valid values are ( json | bicepparam ).")) + c.argument('include_params', arg_type=CLIArgumentType(options_list=['--include-params'], help="Set include params. Valid values are ( all | required-only ).")) with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, diff --git a/src/azure-cli/azure/cli/command_modules/resource/commands.py b/src/azure-cli/azure/cli/command_modules/resource/commands.py index 0c7a34befce..fae004891ce 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/commands.py +++ b/src/azure-cli/azure/cli/command_modules/resource/commands.py @@ -608,8 +608,10 @@ def load_command_table(self, _): g.custom_command('uninstall', 'uninstall_bicep_cli') g.custom_command('upgrade', 'upgrade_bicep_cli') g.custom_command('build', 'build_bicep_file') + g.custom_command('build-params', 'build_bicepparam_file') g.custom_command('format', 'format_bicep_file') g.custom_command('decompile', 'decompile_bicep_file') + g.custom_command('decompile-params', 'decompileparams_bicep_file') g.custom_command('restore', 'restore_bicep_file') g.custom_command('publish', 'publish_bicep_file') g.custom_command('version', 'show_bicep_cli_version') diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index 5c6504299fb..031fa1e7752 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -4282,6 +4282,23 @@ def build_bicep_file(cmd, file, stdout=None, outdir=None, outfile=None, no_resto print(output) +def build_bicepparam_file(cmd, file, stdout=None, outdir=None, outfile=None, no_restore=None): + args = ["build-params", file] + if outdir: + args += ["--outdir", outdir] + if outfile: + args += ["--outfile", outfile] + if no_restore: + args += ["--no-restore"] + if stdout: + args += ["--stdout"] + + output = run_bicep_command(cmd.cli_ctx, args) + + if stdout: + print(output) + + def format_bicep_file(cmd, file, stdout=None, outdir=None, outfile=None, newline=None, indent_kind=None, indent_size=None, insert_final_newline=None): ensure_bicep_installation(cmd.cli_ctx) @@ -4354,6 +4371,31 @@ def decompile_bicep_file(cmd, file, force=None): run_bicep_command(cmd.cli_ctx, args) +def decompileparams_bicep_file(cmd, file, bicep_file=None, no_restore=None, outdir=None, outfile=None, stdout=None): + ensure_bicep_installation(cmd.cli_ctx) + + minimum_supported_version = "0.18.4" + if bicep_version_greater_than_or_equal_to(minimum_supported_version): + args = ["decompile-params", file] + if bicep_file: + args += ["--bicep-file", bicep_file] + if no_restore: + args += ["--no-restore"] + if outdir: + args += ["--outdir", outdir] + if outfile: + args += ["--outfile", outfile] + if stdout: + args += ["--stdout"] + + output = run_bicep_command(cmd.cli_ctx, args) + + if stdout: + print(output) + else: + logger.error("az bicep decompile-params could not be executed with the current version of Bicep CLI. Please upgrade Bicep CLI to v%s or later.", minimum_supported_version) + + def show_bicep_cli_version(cmd): print(run_bicep_command(cmd.cli_ctx, ["--version"], auto_install=False)) @@ -4362,7 +4404,7 @@ def list_bicep_cli_versions(cmd): return get_bicep_available_release_tags() -def generate_params_file(cmd, file, no_restore=None, outdir=None, outfile=None, stdout=None): +def generate_params_file(cmd, file, no_restore=None, outdir=None, outfile=None, stdout=None, output_format=None, include_params=None): ensure_bicep_installation(cmd.cli_ctx) minimum_supported_version = "0.7.4" @@ -4374,6 +4416,10 @@ def generate_params_file(cmd, file, no_restore=None, outdir=None, outfile=None, args += ["--outdir", outdir] if outfile: args += ["--outfile", outfile] + if output_format: + args += ["--output-format", output_format] + if include_params: + args += ["--include-params", include_params] if stdout: args += ["--stdout"] From b03a592d03a61c5a479c3687c6759a078b9d960e Mon Sep 17 00:00:00 2001 From: polatengin Date: Tue, 25 Jul 2023 00:37:52 +0000 Subject: [PATCH 02/23] fixing style linter issues --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index e20226b2ca0..c7c269c459d 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -832,8 +832,7 @@ def load_arguments(self, _): c.argument('bicep_file', arg_type=CLIArgumentType(options_list=['--bicep-file', '-bf'], completer=FilesCompleter(), type=file_type, - help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.") - ) + help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.")) c.argument('outdir', arg_type=bicep_outdir_type) c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type) From 933f275288d649cfefdc7d8c7652e51042507f00 Mon Sep 17 00:00:00 2001 From: polatengin Date: Tue, 25 Jul 2023 01:08:14 +0000 Subject: [PATCH 03/23] fixing linter issues --- .../azure/cli/command_modules/resource/_help.py | 10 +++------- .../azure/cli/command_modules/resource/_params.py | 2 +- .../azure/cli/command_modules/resource/custom.py | 4 +--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_help.py b/src/azure-cli/azure/cli/command_modules/resource/_help.py index a7afb8a4c0c..c96e8ada6e5 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_help.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_help.py @@ -2792,13 +2792,11 @@ short-summary: Build .bicepparam file. examples: - name: Build a .bicepparam file. - text: az bicep build --file {bicepparam_file} + text: az bicep build-params --file {bicepparam_file} - name: Build a .bicepparam file and print all output to stdout. - text: az bicep build --file {bicepparam_file} --stdout + text: az bicep build-params --file {bicepparam_file} --stdout - name: Build a .bicepparam file and save the result to the specified file. - text: az bicep build --file {bicepparam_file} --outfile {out_file} - - name: Build a .bicepparam file without restoring external modules. - text: az bicep build --file {bicepparam_file} --no-restore + text: az bicep build-params --file {bicepparam_file} --outfile {out_file} """ helps['bicep format'] = """ @@ -2845,8 +2843,6 @@ text: az bicep decompile-params --file {json_template_file} --outdir {out_dir} - name: Attempts to decompile a parameters .json file to .bicepparam and print all output to stdout and save the result to the specified file. text: az bicep decompile-params --file {json_template_file} --outfile {out_file} - - name: Attempts to decompile a parameters .json file to .bicepparam and overwrite existing file. - text: az bicep decompile-params --file {json_template_file} --force """ helps['bicep publish'] = """ diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index c7c269c459d..86eaba4f535 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -829,7 +829,7 @@ def load_arguments(self, _): with self.argument_context('bicep decompile-params') as c: c.argument('file', arg_type=bicep_file_type, help="The path to the parameters file to build in the file system.") - c.argument('bicep_file', arg_type=CLIArgumentType(options_list=['--bicep-file', '-bf'], + c.argument('bicep_file', arg_type=CLIArgumentType(options_list=['--bicep-file'], completer=FilesCompleter(), type=file_type, help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.")) diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index 031fa1e7752..8783bcd35a6 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -4371,7 +4371,7 @@ def decompile_bicep_file(cmd, file, force=None): run_bicep_command(cmd.cli_ctx, args) -def decompileparams_bicep_file(cmd, file, bicep_file=None, no_restore=None, outdir=None, outfile=None, stdout=None): +def decompileparams_bicep_file(cmd, file, bicep_file=None, outdir=None, outfile=None, stdout=None): ensure_bicep_installation(cmd.cli_ctx) minimum_supported_version = "0.18.4" @@ -4379,8 +4379,6 @@ def decompileparams_bicep_file(cmd, file, bicep_file=None, no_restore=None, outd args = ["decompile-params", file] if bicep_file: args += ["--bicep-file", bicep_file] - if no_restore: - args += ["--no-restore"] if outdir: args += ["--outdir", outdir] if outfile: From b9d889583bee665f8752abcbff01bd08faba0d90 Mon Sep 17 00:00:00 2001 From: polatengin Date: Wed, 9 Aug 2023 17:36:13 +0000 Subject: [PATCH 04/23] adding bicep generate-params test --- .../resource/tests/latest/test_resource_custom.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 46badb0d93e..9c975cc7e78 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -29,6 +29,8 @@ format_bicep_file, ) +from azure.cli.command_modules.resource._bicep import (run_bicep_command) + from azure.cli.core.mock import DummyCli from azure.cli.core import AzCommandsLoader from azure.cli.core.commands import AzCliCommand @@ -339,6 +341,7 @@ def test_deployment_prompt_file_order(self): def test_deployment_prompt_alphabetical_order(self): # check that params are prompted for in alphabetical order when the file is loaded with preserve_order=False curr_dir = os.path.dirname(os.path.realpath(__file__)) + template_path = os.path.join(curr_dir, 'param-validation-template.json').replace('\\', '\\\\') parameters_path = os.path.join(curr_dir, 'param-validation-params.json').replace('\\', '\\\\') parameters_with_reference_path = os.path.join(curr_dir, 'param-validation-ref-params.json').replace('\\', '\\\\') @@ -362,6 +365,11 @@ def test_deployment_bicepparam_file_input_check(self): self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam']]), True) self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam'], ['test.json'], ['{ \"foo\": { \"value\": \"bar\" } }']]), True) + def test_bicep_generate_params(self): + run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep"]) + is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + self.assertTrue(is_generated_params_file_exists) + @mock.patch("knack.prompting.prompt_y_n", autospec=True) @mock.patch("azure.cli.command_modules.resource.custom._what_if_deploy_arm_template_at_resource_group_core", autospec=True) def test_confirm_with_what_if_prompt_at_resource_group(self, what_if_command_mock, prompt_y_n_mock): From a5e42e764f66bd6d1432491ea4bebef03850e55a Mon Sep 17 00:00:00 2001 From: polatengin Date: Wed, 9 Aug 2023 18:35:29 +0000 Subject: [PATCH 05/23] adding bicep new generate-params tests --- .../resource/tests/latest/test_resource_custom.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 9c975cc7e78..cc3b836ae61 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -365,11 +365,21 @@ def test_deployment_bicepparam_file_input_check(self): self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam']]), True) self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam'], ['test.json'], ['{ \"foo\": { \"value\": \"bar\" } }']]), True) - def test_bicep_generate_params(self): + def test_bicep_generate_params_defaults(self): run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep"]) is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") self.assertTrue(is_generated_params_file_exists) + def test_bicep_generate_params_output_format(self): + run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep", "--output-format", "json"]) + is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + self.assertTrue(is_generated_params_file_exists) + + def test_bicep_generate_params_include_params(self): + run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep", "--include-params", "all"]) + is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + self.assertTrue(is_generated_params_file_exists) + @mock.patch("knack.prompting.prompt_y_n", autospec=True) @mock.patch("azure.cli.command_modules.resource.custom._what_if_deploy_arm_template_at_resource_group_core", autospec=True) def test_confirm_with_what_if_prompt_at_resource_group(self, what_if_command_mock, prompt_y_n_mock): From 59dc06c45af15b673e1a88b3e535792ba04cf893 Mon Sep 17 00:00:00 2001 From: polatengin Date: Wed, 9 Aug 2023 18:44:54 +0000 Subject: [PATCH 06/23] adding a bicep build-params test --- .../resource/tests/latest/sample_params.bicepparam | 8 ++++++++ .../resource/tests/latest/test_resource_custom.py | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 src/azure-cli/azure/cli/command_modules/resource/tests/latest/sample_params.bicepparam diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/sample_params.bicepparam b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/sample_params.bicepparam new file mode 100644 index 00000000000..5cc2fd7dc14 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/sample_params.bicepparam @@ -0,0 +1,8 @@ +using './sample_params.bicep' + +param demoString = '' +param demoInt = 0 +param demoBool = false +param demoObject = {} +param demoArray = [] + diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index cc3b836ae61..72d394cdde0 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -380,6 +380,11 @@ def test_bicep_generate_params_include_params(self): is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") self.assertTrue(is_generated_params_file_exists) + def test_bicep_build_params_defaults(self): + run_bicep_command(cli_ctx, ["build-params", "./sample_params.bicepparam"]) + is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + self.assertTrue(is_generated_params_file_exists) + @mock.patch("knack.prompting.prompt_y_n", autospec=True) @mock.patch("azure.cli.command_modules.resource.custom._what_if_deploy_arm_template_at_resource_group_core", autospec=True) def test_confirm_with_what_if_prompt_at_resource_group(self, what_if_command_mock, prompt_y_n_mock): From 3fd2c5bcdaaece534e2e2155ec0ed07e95b7b61a Mon Sep 17 00:00:00 2001 From: polatengin Date: Wed, 9 Aug 2023 19:51:07 +0000 Subject: [PATCH 07/23] adding a bicep decompile-params test --- .../resource/tests/latest/test_resource_custom.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 72d394cdde0..487d9def9ed 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -385,6 +385,11 @@ def test_bicep_build_params_defaults(self): is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") self.assertTrue(is_generated_params_file_exists) + def test_bicep_decompile_params_defaults(self): + run_bicep_command(cli_ctx, ["decompile-params", "./param-validation-params.json"]) + is_generated_params_file_exists = os.path.exists("./param-validation-params.bicepparam") + self.assertTrue(is_generated_params_file_exists) + @mock.patch("knack.prompting.prompt_y_n", autospec=True) @mock.patch("azure.cli.command_modules.resource.custom._what_if_deploy_arm_template_at_resource_group_core", autospec=True) def test_confirm_with_what_if_prompt_at_resource_group(self, what_if_command_mock, prompt_y_n_mock): From 6eb0a7421b2442226d7c6223a954e255ff09f4ca Mon Sep 17 00:00:00 2001 From: polatengin Date: Thu, 10 Aug 2023 02:48:57 +0000 Subject: [PATCH 08/23] fixing failing test --- .../resource/tests/latest/test_resource_custom.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 487d9def9ed..6213f1a0770 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -386,7 +386,7 @@ def test_bicep_build_params_defaults(self): self.assertTrue(is_generated_params_file_exists) def test_bicep_decompile_params_defaults(self): - run_bicep_command(cli_ctx, ["decompile-params", "./param-validation-params.json"]) + run_bicep_command(cli_ctx, ["decompile-params", "./param-validation-params.json", "--force"]) is_generated_params_file_exists = os.path.exists("./param-validation-params.bicepparam") self.assertTrue(is_generated_params_file_exists) @@ -584,7 +584,8 @@ def test_format_bicep_file(self, mock_print, mock_run_bicep_command, mock_bicep_ # Assert. mock_bicep_version_greater_than_or_equal_to.assert_called_once_with("0.12.1") - mock_run_bicep_command.assert_called_once_with(cmd.cli_ctx, ["format", file_path, "--stdout"]) - + mock_run_bicep_command.assert_called_once_with(cmd.cli_ctx, ["format", file_path, "--stdout"]) + + if __name__ == '__main__': unittest.main() From 00f886f921df1dae24181d4629443cbe53df22d4 Mon Sep 17 00:00:00 2001 From: polatengin Date: Thu, 10 Aug 2023 02:50:15 +0000 Subject: [PATCH 09/23] adding new tests --- .../resource/tests/latest/test_resource.py | 89 ++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py index 2e1f58d6d1a..a1014401ad4 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource.py @@ -4987,6 +4987,66 @@ def test_bicep_list_versions(self): self.greater_than('length(@)', 0) ]) +class BicepDecompileParamsTest(ScenarioTest): + def setup(self): + super().setup() + self.cmd('az bicep uninstall') + + def tearDown(self): + super().tearDown() + self.cmd('az bicep uninstall') + + def test_bicep_decompile_params_file(self): + curr_dir = os.path.dirname(os.path.realpath(__file__)) + tf = os.path.join(curr_dir, 'test-params.json').replace('\\', '\\\\') + params_path = os.path.join(curr_dir, 'test-params.bicepparam').replace('\\', '\\\\') + self.kwargs.update({ + 'tf': tf, + 'params_path': params_path, + }) + + self.cmd('az bicep decompile-params --file {tf}') + + if os.path.exists(params_path): + os.remove(params_path) + +class BicepBuildParamsTest(ScenarioTest): + def setup(self): + super().setup() + self.cmd('az bicep uninstall') + + def tearDown(self): + super().tearDown() + self.cmd('az bicep uninstall') + + def test_bicep_build_params_file(self): + curr_dir = os.path.dirname(os.path.realpath(__file__)) + tf = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') + params_path = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + self.kwargs.update({ + 'tf': tf, + 'params_path': params_path, + }) + + self.cmd('az bicep build-params --file {tf}') + + if os.path.exists(params_path): + os.remove(params_path) + + def test_bicep_build_params_file_outfile(self): + curr_dir = os.path.dirname(os.path.realpath(__file__)) + tf = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') + params_path = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + self.kwargs.update({ + 'tf': tf, + 'params_path': params_path, + }) + + self.cmd('az bicep build-params --file {tf} --outfile {params_path}') + + if os.path.exists(params_path): + os.remove(params_path) + # Because don't want to record bicep cli binary class BicepBuildTest(LiveScenarioTest): @@ -5019,7 +5079,6 @@ def test_bicep_build_decompile(self): os.remove(decompile_path) class BicepGenerateParamsTest(LiveScenarioTest): - def setup(self): super().setup() self.cmd('az bicep uninstall') @@ -5028,6 +5087,34 @@ def tearDown(self): super().tearDown() self.cmd('az bicep uninstall') + def test_bicep_generate_params_output_format_only(self): + curr_dir = os.path.dirname(os.path.realpath(__file__)) + tf = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') + params_path = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + self.kwargs.update({ + 'tf': tf, + 'params_path': params_path, + }) + + self.cmd('az bicep generate-params -f {tf} --outfile {params_path} --output-format json') + + if os.path.exists(params_path): + os.remove(params_path) + + def test_bicep_generate_params_include_params_only(self): + curr_dir = os.path.dirname(os.path.realpath(__file__)) + tf = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') + params_path = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + self.kwargs.update({ + 'tf': tf, + 'params_path': params_path, + }) + + self.cmd('az bicep generate-params -f {tf} --outfile {params_path} --include-params all') + + if os.path.exists(params_path): + os.remove(params_path) + def test_bicep_generate_params(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) tf = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') From c3301c30a0c8cb386dec1dce35083a173acc02db Mon Sep 17 00:00:00 2001 From: polatengin Date: Thu, 10 Aug 2023 03:24:18 +0000 Subject: [PATCH 10/23] fixing failing test --- .../resource/tests/latest/test_resource_custom.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 6213f1a0770..423a80a7902 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -381,8 +381,14 @@ def test_bicep_generate_params_include_params(self): self.assertTrue(is_generated_params_file_exists) def test_bicep_build_params_defaults(self): - run_bicep_command(cli_ctx, ["build-params", "./sample_params.bicepparam"]) - is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + curr_dir = os.path.dirname(os.path.realpath(__file__)) + + param_file = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') + json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + + run_bicep_command(cli_ctx, ["build-params", param_file]) + is_generated_params_file_exists = os.path.exists(json_file) + self.assertTrue(is_generated_params_file_exists) def test_bicep_decompile_params_defaults(self): From 12e7ba84a33364dd6b480d2e59119294383187c4 Mon Sep 17 00:00:00 2001 From: polatengin Date: Thu, 10 Aug 2023 03:58:53 +0000 Subject: [PATCH 11/23] fixing failing tests --- .../tests/latest/test_resource_custom.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 423a80a7902..fc246db4446 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -386,14 +386,26 @@ def test_bicep_build_params_defaults(self): param_file = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + print(param_file) + print(json_file) + run_bicep_command(cli_ctx, ["build-params", param_file]) is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) def test_bicep_decompile_params_defaults(self): - run_bicep_command(cli_ctx, ["decompile-params", "./param-validation-params.json", "--force"]) - is_generated_params_file_exists = os.path.exists("./param-validation-params.bicepparam") + curr_dir = os.path.dirname(os.path.realpath(__file__)) + + param_file = os.path.join(curr_dir, 'param-validation-params.bicepparam').replace('\\', '\\\\') + json_file = os.path.join(curr_dir, 'param-validation-params.json').replace('\\', '\\\\') + + print(param_file) + print(json_file) + + run_bicep_command(cli_ctx, ["decompile-params", json_file, "--force"]) + is_generated_params_file_exists = os.path.exists(param_file) + self.assertTrue(is_generated_params_file_exists) @mock.patch("knack.prompting.prompt_y_n", autospec=True) From 5b903e3888b67763a81b212f24a3c5c7eab88376 Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 11 Aug 2023 19:27:12 +0000 Subject: [PATCH 12/23] fixing failing tests --- .../tests/latest/test_resource_custom.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index fc246db4446..990a3927b3a 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -366,29 +366,37 @@ def test_deployment_bicepparam_file_input_check(self): self.assertEqual(_is_bicepparam_file_provided([['test.bicepparam'], ['test.json'], ['{ \"foo\": { \"value\": \"bar\" } }']]), True) def test_bicep_generate_params_defaults(self): - run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep"]) - is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + curr_dir = os.path.dirname(os.path.realpath(__file__)) + bicep_file = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') + json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + + run_bicep_command(cli_ctx, ["generate-params", bicep_file]) + is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) def test_bicep_generate_params_output_format(self): - run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep", "--output-format", "json"]) - is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + curr_dir = os.path.dirname(os.path.realpath(__file__)) + bicep_file = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') + json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + + run_bicep_command(cli_ctx, ["generate-params", bicep_file, "--output-format", "json"]) + is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) def test_bicep_generate_params_include_params(self): - run_bicep_command(cli_ctx, ["generate-params", "./sample_params.bicep", "--include-params", "all"]) - is_generated_params_file_exists = os.path.exists("./sample_params.parameters.json") + curr_dir = os.path.dirname(os.path.realpath(__file__)) + bicep_file = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\') + json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + + run_bicep_command(cli_ctx, ["generate-params", bicep_file, "--include-params", "all"]) + is_generated_params_file_exists = os.path.exists(json_file) self.assertTrue(is_generated_params_file_exists) def test_bicep_build_params_defaults(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) - param_file = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') - print(param_file) - print(json_file) - run_bicep_command(cli_ctx, ["build-params", param_file]) is_generated_params_file_exists = os.path.exists(json_file) @@ -396,13 +404,9 @@ def test_bicep_build_params_defaults(self): def test_bicep_decompile_params_defaults(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) - param_file = os.path.join(curr_dir, 'param-validation-params.bicepparam').replace('\\', '\\\\') json_file = os.path.join(curr_dir, 'param-validation-params.json').replace('\\', '\\\\') - print(param_file) - print(json_file) - run_bicep_command(cli_ctx, ["decompile-params", json_file, "--force"]) is_generated_params_file_exists = os.path.exists(param_file) From 76214fb3d1b5181716b0afa6174788e83e17fe34 Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 11 Aug 2023 20:03:59 +0000 Subject: [PATCH 13/23] fixing a failing test --- .../resource/tests/latest/test_resource_custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py index 990a3927b3a..c6c37f8607b 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/tests/latest/test_resource_custom.py @@ -395,7 +395,7 @@ def test_bicep_generate_params_include_params(self): def test_bicep_build_params_defaults(self): curr_dir = os.path.dirname(os.path.realpath(__file__)) param_file = os.path.join(curr_dir, 'sample_params.bicepparam').replace('\\', '\\\\') - json_file = os.path.join(curr_dir, 'sample_params.parameters.json').replace('\\', '\\\\') + json_file = os.path.join(curr_dir, 'sample_params.json').replace('\\', '\\\\') run_bicep_command(cli_ctx, ["build-params", param_file]) is_generated_params_file_exists = os.path.exists(json_file) From a063206b0773b90188e7d3480d0bf1f3669f5c87 Mon Sep 17 00:00:00 2001 From: Engin Polat Date: Thu, 17 Aug 2023 21:44:04 -0700 Subject: [PATCH 14/23] Update src/azure-cli/azure/cli/command_modules/resource/_help.py Co-authored-by: Xing Zhou --- src/azure-cli/azure/cli/command_modules/resource/_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_help.py b/src/azure-cli/azure/cli/command_modules/resource/_help.py index c96e8ada6e5..359c57a799f 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_help.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_help.py @@ -2831,7 +2831,7 @@ helps['bicep decompile-params'] = """ type: command -short-summary: Attempts to decompile a parameters .json file to .bicepparam. +short-summary: Decompile a parameters .json file to .bicepparam. examples: - name: Attempts to decompile a parameters .json file to .bicepparam. text: az bicep decompile-params --file {json_template_file} From 655ccd7b2731b4929fe569e881d1bfb3680085b2 Mon Sep 17 00:00:00 2001 From: Engin Polat Date: Thu, 17 Aug 2023 21:44:56 -0700 Subject: [PATCH 15/23] Update src/azure-cli/azure/cli/command_modules/resource/_params.py Co-authored-by: Xing Zhou --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 86eaba4f535..f58f3148176 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -863,8 +863,8 @@ def load_arguments(self, _): c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") - c.argument('output_format', arg_type=CLIArgumentType(options_list=['--output-format'], help="Set output format. Valid values are ( json | bicepparam ).")) - c.argument('include_params', arg_type=CLIArgumentType(options_list=['--include-params'], help="Set include params. Valid values are ( all | required-only ).")) + c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).")) + c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).")) with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, From b519d830a7fcd462796d0a2c9f9f87b295501647 Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 25 Aug 2023 16:26:22 +0000 Subject: [PATCH 16/23] fixing typos --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index f58f3148176..76579620033 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -863,8 +863,8 @@ def load_arguments(self, _): c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") - c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).")) - c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).")) + c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).") + c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).") with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, From c99fb0b870ef8711bdb6af8057347acd5271cad6 Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 25 Aug 2023 17:37:08 +0000 Subject: [PATCH 17/23] removed dot --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 76579620033..0a68633432a 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -864,7 +864,7 @@ def load_arguments(self, _): c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).") - c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).") + c.argument('include_params', help="Set include params. Valid values are ( all | required-only )") with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, From 09b2c590f48b1ff4f23341a3a9078f248fd100df Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 25 Aug 2023 17:37:24 +0000 Subject: [PATCH 18/23] fixing a typo --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 0a68633432a..76579620033 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -864,7 +864,7 @@ def load_arguments(self, _): c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).") - c.argument('include_params', help="Set include params. Valid values are ( all | required-only )") + c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).") with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, From 6176d7519a4cf6e61ac04944130a0604995f4c5e Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 25 Aug 2023 19:20:22 +0000 Subject: [PATCH 19/23] removed dot --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 76579620033..0a68633432a 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -864,7 +864,7 @@ def load_arguments(self, _): c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).") - c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).") + c.argument('include_params', help="Set include params. Valid values are ( all | required-only )") with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, From 0a666d200760898362feb6df94cd79b3f5b28a71 Mon Sep 17 00:00:00 2001 From: polatengin Date: Fri, 25 Aug 2023 19:20:52 +0000 Subject: [PATCH 20/23] fixing a typo --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 0a68633432a..76579620033 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -864,7 +864,7 @@ def load_arguments(self, _): c.argument('stdout', arg_type=bicep_stdout_type) c.argument('no_restore', arg_type=bicep_no_restore_type, help="When set, generates the parameters file without restoring external modules.") c.argument('output_format', help="Set output format. Valid values are ( json | bicepparam ).") - c.argument('include_params', help="Set include params. Valid values are ( all | required-only )") + c.argument('include_params', help="Set include params. Valid values are ( all | required-only ).") with self.argument_context('resourcemanagement private-link create') as c: c.argument('resource_group', arg_type=resource_group_name_type, From 02e57f29275189e67ead19b9289b49592ee56af6 Mon Sep 17 00:00:00 2001 From: Engin Polat Date: Tue, 29 Aug 2023 13:51:19 -0700 Subject: [PATCH 21/23] Update src/azure-cli/azure/cli/command_modules/resource/_params.py Co-authored-by: Xing Zhou --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 76579620033..0f7aa29dc43 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -829,10 +829,7 @@ def load_arguments(self, _): with self.argument_context('bicep decompile-params') as c: c.argument('file', arg_type=bicep_file_type, help="The path to the parameters file to build in the file system.") - c.argument('bicep_file', arg_type=CLIArgumentType(options_list=['--bicep-file'], - completer=FilesCompleter(), - type=file_type, - help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.")) + c.argument('bicep_file', completer=FilesCompleter(), type=file_type, help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.") c.argument('outdir', arg_type=bicep_outdir_type) c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type) From b331cec80093f0e6fe065bb20937a8ceae40ed51 Mon Sep 17 00:00:00 2001 From: polatengin Date: Tue, 29 Aug 2023 22:02:58 +0000 Subject: [PATCH 22/23] removed dot --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index 0f7aa29dc43..e4ed10f4653 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -829,7 +829,7 @@ def load_arguments(self, _): with self.argument_context('bicep decompile-params') as c: c.argument('file', arg_type=bicep_file_type, help="The path to the parameters file to build in the file system.") - c.argument('bicep_file', completer=FilesCompleter(), type=file_type, help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.") + c.argument('bicep_file', completer=FilesCompleter(), type=file_type, help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration") c.argument('outdir', arg_type=bicep_outdir_type) c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type) From b254ef6ae78bb67650361fdf62ab7a4d57032bbd Mon Sep 17 00:00:00 2001 From: polatengin Date: Tue, 29 Aug 2023 22:03:34 +0000 Subject: [PATCH 23/23] fixing a typo --- src/azure-cli/azure/cli/command_modules/resource/_params.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/_params.py b/src/azure-cli/azure/cli/command_modules/resource/_params.py index e4ed10f4653..0f7aa29dc43 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/_params.py +++ b/src/azure-cli/azure/cli/command_modules/resource/_params.py @@ -829,7 +829,7 @@ def load_arguments(self, _): with self.argument_context('bicep decompile-params') as c: c.argument('file', arg_type=bicep_file_type, help="The path to the parameters file to build in the file system.") - c.argument('bicep_file', completer=FilesCompleter(), type=file_type, help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration") + c.argument('bicep_file', completer=FilesCompleter(), type=file_type, help="Path to the bicep template file (relative to the .bicepparam file) that will be referenced in the using declaration.") c.argument('outdir', arg_type=bicep_outdir_type) c.argument('outfile', arg_type=bicep_outfile_type) c.argument('stdout', arg_type=bicep_stdout_type)