Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Generate sam delete and sam traces schema #5610

Merged
merged 5 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions samcli/commands/_utils/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="""
Expand Down
8 changes: 8 additions & 0 deletions samcli/commands/logs/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 10 additions & 3 deletions samcli/commands/traces/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,20 +53,20 @@
def cli(
ctx,
trace_id,
tail,
start_time,
end_time,
tail,
output,
config_file,
config_env,
):
"""
`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
"""
Expand Down
100 changes: 96 additions & 4 deletions schema/samcli.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
Leo10Gama marked this conversation as resolved.
Show resolved Hide resolved
]
},
"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": [
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/commands/traces/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
Loading