diff --git a/samcli/commands/_utils/options.py b/samcli/commands/_utils/options.py index 24f5eef3a6..e2d2971928 100644 --- a/samcli/commands/_utils/options.py +++ b/samcli/commands/_utils/options.py @@ -367,13 +367,6 @@ def common_observability_click_options(): help="Fetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or " "formatted timestamp like '2018-01-01 10:10:10'", ), - click.option( - "--tail", - "-t", - is_flag=True, - help="Tail events. This will ignore the end time argument and continue to fetch events as they " - "become available. If option --tail without a --name will pull from all possible resources", - ), click.option( "--output", help=""" diff --git a/samcli/commands/logs/command.py b/samcli/commands/logs/command.py index f8df636b59..e7336f2d7a 100644 --- a/samcli/commands/logs/command.py +++ b/samcli/commands/logs/command.py @@ -71,6 +71,14 @@ "supported by AWS CloudWatch Logs. See the AWS CloudWatch Logs documentation for the syntax " "https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html", ) +@click.option( + "--tail", + "-t", + is_flag=True, + help="Tail events. This will ignore the end time argument and continue to fetch events as they " + "become available. If option --tail is provided without a --name, one will be pulled from all " + "possible resources", +) @click.option( "--include-traces", "-i", diff --git a/samcli/commands/traces/command.py b/samcli/commands/traces/command.py index d82b6871ab..434371319a 100644 --- a/samcli/commands/traces/command.py +++ b/samcli/commands/traces/command.py @@ -35,6 +35,13 @@ multiple=True, help="Fetch specific trace by providing its id", ) +@click.option( + "--tail", + "-t", + is_flag=True, + help="Tail events. This will ignore the end time argument and continue to fetch events as they " + "become available.", +) @common_observability_options @cli_framework_options @aws_creds_options @@ -46,9 +53,9 @@ def cli( ctx, trace_id, + tail, start_time, end_time, - tail, output, config_file, config_env, @@ -56,10 +63,10 @@ def cli( """ `sam traces` command entry point """ - do_cli(trace_id, start_time, end_time, tail, output, ctx.region) + do_cli(trace_id, tail, start_time, end_time, output, ctx.region) -def do_cli(trace_ids, start_time, end_time, tailing, output, region): +def do_cli(trace_ids, tailing, start_time, end_time, output, region): """ Implementation of the ``cli`` method """ diff --git a/schema/samcli.json b/schema/samcli.json index fae02bf9aa..011ca0bec5 100644 --- a/schema/samcli.json +++ b/schema/samcli.json @@ -1161,9 +1161,50 @@ "properties": { "parameters": { "title": "Parameters for the delete command", - "description": "Available parameters for the delete command:\n", + "description": "Available parameters for the delete command:\n* stack_name:\nThe name of the AWS CloudFormation stack you want to delete.\n* no_prompts:\nSpecify this flag to allow SAM CLI to skip through the guided prompts.\n* s3_bucket:\nThe S3 bucket path you want to delete.\n* s3_prefix:\nThe S3 prefix you want to delete\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.", "type": "object", - "properties": {} + "properties": { + "stack_name": { + "title": "stack_name", + "type": "string", + "description": "The name of the AWS CloudFormation stack you want to delete." + }, + "no_prompts": { + "title": "no_prompts", + "type": "boolean", + "description": "Specify this flag to allow SAM CLI to skip through the guided prompts." + }, + "s3_bucket": { + "title": "s3_bucket", + "type": "string", + "description": "The S3 bucket path you want to delete." + }, + "s3_prefix": { + "title": "s3_prefix", + "type": "string", + "description": "The S3 prefix you want to delete" + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + } + } } }, "required": [ @@ -1206,9 +1247,60 @@ "properties": { "parameters": { "title": "Parameters for the traces command", - "description": "Available parameters for the traces command:\n", + "description": "Available parameters for the traces command:\n* trace_id:\nFetch specific trace by providing its id\n* tail:\nTail events. This will ignore the end time argument and continue to fetch events as they become available.\n* output:\nThe formatting style of the command output. Following options are available:\n\nTEXT: Prints information as regular text with some formatting (default option)\n\nJSON: Prints each line as JSON without formatting\n* end_time:\nFetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or formatted timestamp like '2018-01-01 10:10:10'\n* start_time:\nFetch events starting at this time. Time can be relative values like '5mins ago', 'yesterday' or formatted timestamp like '2018-01-01 10:10:10'. Defaults to '10mins ago'.\n* beta_features:\nEnable/Disable beta features.\n* debug:\nTurn on debug logging to print debug message generated by AWS SAM CLI and display timestamps.\n* profile:\nSelect a specific profile from your credential file to get AWS credentials.\n* region:\nSet the AWS Region of the service. (e.g. us-east-1)", "type": "object", - "properties": {} + "properties": { + "trace_id": { + "title": "trace_id", + "type": "string", + "description": "Fetch specific trace by providing its id" + }, + "tail": { + "title": "tail", + "type": "boolean", + "description": "Tail events. This will ignore the end time argument and continue to fetch events as they become available." + }, + "output": { + "title": "output", + "type": "string", + "description": "The formatting style of the command output. Following options are available:\n\nTEXT: Prints information as regular text with some formatting (default option)\n\nJSON: Prints each line as JSON without formatting", + "enum": [ + "json", + "text" + ] + }, + "end_time": { + "title": "end_time", + "type": "string", + "description": "Fetch events up to this time. Time can be relative values like '5mins ago', 'tomorrow' or formatted timestamp like '2018-01-01 10:10:10'" + }, + "start_time": { + "title": "start_time", + "type": "string", + "description": "Fetch events starting at this time. Time can be relative values like '5mins ago', 'yesterday' or formatted timestamp like '2018-01-01 10:10:10'. Defaults to '10mins ago'.", + "default": "10m ago" + }, + "beta_features": { + "title": "beta_features", + "type": "boolean", + "description": "Enable/Disable beta features." + }, + "debug": { + "title": "debug", + "type": "boolean", + "description": "Turn on debug logging to print debug message generated by AWS SAM CLI and display timestamps." + }, + "profile": { + "title": "profile", + "type": "string", + "description": "Select a specific profile from your credential file to get AWS credentials." + }, + "region": { + "title": "region", + "type": "string", + "description": "Set the AWS Region of the service. (e.g. us-east-1)" + } + } } }, "required": [ diff --git a/tests/unit/commands/traces/test_command.py b/tests/unit/commands/traces/test_command.py index 59bc6185b4..3b70cf3e62 100644 --- a/tests/unit/commands/traces/test_command.py +++ b/tests/unit/commands/traces/test_command.py @@ -50,7 +50,7 @@ def test_traces_command( given_puller = Mock() patched_generate_puller.return_value = given_puller - do_cli(trace_ids, start_time, end_time, tail, output, self.region) + do_cli(trace_ids, tail, start_time, end_time, output, self.region) patched_parse_time.assert_has_calls( [