def format_examples()

in samcli/commands/local/start_lambda/core/command.py [0:0]


    def format_examples(ctx: Context, formatter: InvokeStartLambdaCommandHelpTextFormatter):
        AWS_SDK_EXAMPLE = """
        self.lambda_client = boto3.client('lambda',
                                          endpoint_url="http://127.0.0.1:3001",
                                          use_ssl=False,
                                          verify=False,
                                          config=Config(signature_version=UNSIGNED,
                                                        read_timeout=0,
                                                        retries={'max_attempts': 0}))
        self.lambda_client.invoke(FunctionName="HelloWorldFunction")
        """

        with formatter.indented_section(name="Examples", extra_indents=1):
            with formatter.indented_section(name="Setup", extra_indents=1):
                formatter.write_rd(
                    [
                        RowDefinition(
                            text="\n",
                        ),
                        RowDefinition(
                            name="Start the local lambda endpoint.",
                        ),
                        RowDefinition(
                            name=style(f"${ctx.command_path}"),
                            extra_row_modifiers=[ShowcaseRowModifier()],
                        ),
                    ]
                )
            with formatter.indented_section(name="Using AWS CLI", extra_indents=1):
                formatter.write_rd(
                    [
                        RowDefinition(
                            text="\n",
                        ),
                        RowDefinition(
                            name="Invoke Lambda function locally using the AWS CLI.",
                        ),
                        RowDefinition(
                            name=style(
                                "$ aws lambda invoke --function-name HelloWorldFunction "
                                "--endpoint-url http://127.0.0.1:3001 --no-verify-ssl out.txt"
                            ),
                            extra_row_modifiers=[ShowcaseRowModifier()],
                        ),
                    ]
                )
            with formatter.indented_section(name="Using AWS SDK", extra_indents=1):
                formatter.write_rd(
                    [
                        RowDefinition(
                            text="\n",
                        ),
                        RowDefinition(
                            name="Use AWS SDK in automated tests.",
                        ),
                        RowDefinition(
                            name=AWS_SDK_EXAMPLE,
                            extra_row_modifiers=[ShowcaseRowModifier()],
                        ),
                    ]
                )