Repository: influxdata/influxdb
File: influxdb3/src/commands/create.rs (Rust)

Code before:
                    ",
                        token = response.token,
                    );
                }
                Err(err) => {
                    println!("Failed to create token, error: {:?}", err);
                }
            }
        }
        SubCommand::Trigger(TriggerConfig {
            influxdb3_config: InfluxDb3Config { database_name, .. },
            trigger_name,
            plugin_filename,
            trigger_specification,
            trigger_arguments,
            disabled,
            run_asynchronous,
            error_behavior,
        }) => {
            let trigger_arguments: Option<HashMap<String, String>> = trigger_arguments.map(|a| {
                a.into_iter()
                    .map(|SeparatedKeyValue((k, v))| (k, v))
                    .collect::<HashMap<String, String>>()
            });

            let trigger_settings = TriggerSettings {
                run_async: run_asynchronous,
                error_behavior,
            };

            match client
                .api_v3_configure_processing_engine_trigger_create(
                    database_name,
                    &trigger_name,
                    plugin_filename,
                    trigger_specification.string_rep(),
                    trigger_arguments,
                    disabled,
                    trigger_settings,
                )
                .await
            {
                Err(e) => {
                    eprintln!("Failed to create trigger: {}", e);
                    return Err(e.into());
                }
                Ok(_) => println!("Trigger {} created successfully", trigger_name),
            }
        }
    }
    Ok(())

Review comment (suggestion):
I've reworded this message, happy to tweak this message based on the feedback. The reason for the change is,

- we don't need the token to be passed in
- the token should also be used for GRPC requests

Code after:
                        .expect("serialize distinct cache definition as JSON")
                ),
                None => println!("a cache already exists for the provided parameters"),
            }
        }
        SubCommand::Table(TableConfig {
            influxdb3_config: InfluxDb3Config { database_name, .. },
            table_name,
            tags,
            fields,
            ..
        }) => {
            client
                .api_v3_configure_table_create(&database_name, &table_name, tags, fields)
                .await?;

            println!(
                "Table {:?}.{:?} created successfully",
                &database_name, &table_name
            );
        }
        SubCommand::Token(token_commands) => {
            match handle_token_creation(client, token_commands).await {
                Ok(response) => {
                    println!(
                        "\n\
                        Token: {token}\n\
                            \n\
                        HTTP requests require the following header: \"Authorization: Bearer {token}\"\n\
                        This will grant you access to HTTP/GRPC API.
                    ",
                        token = response.token,
                    );
                }
                Err(err) => {
                    println!("Failed to create token, error: {:?}", err);
                }
            }
        }
        SubCommand::Trigger(TriggerConfig {
            influxdb3_config: InfluxDb3Config { database_name, .. },
            trigger_name,
            plugin_filename,
            trigger_specification,
            trigger_arguments,
            disabled,
            run_asynchronous,
            error_behavior,
            ..
        }) => {
            let trigger_arguments: Option<HashMap<String, String>> = trigger_arguments.map(|a| {