pub struct FormField {
pub name: String,
pub label: String,
pub field_type: FieldType,
pub required: bool,
pub placeholder: Option<String>,
pub help_text: Option<String>,
pub default_value: Option<String>,
pub group: Option<String>,
pub env: Vec<String>,
}Expand description
A single form field.
Fields§
§name: StringField name used as the key when submitting (e.g. “api_key”).
label: StringLabel shown next to the input.
field_type: FieldTypeInput type.
required: boolWhether the field is required.
placeholder: Option<String>Placeholder text inside the input.
help_text: Option<String>Help text shown below the input.
default_value: Option<String>Default value the UI pre-fills (e.g. an OAuth scope or AWS region). The stored credential omits unfilled optional fields, so drivers still apply their own defaults; this only seeds the form input.
group: Option<String>Mutually-exclusive group label this field belongs to. Fields sharing a
label are one alternative credential method (e.g. “API key” vs “OAuth”);
ungrouped fields are always part of the credential. None for the
common single-method case.
env: Vec<String>Environment variables this field can be read from in standalone/dev use, most preferred first.
Declared by the driver, because only the driver knows what its vendor’s
own SDK reads: AWS_ACCESS_KEY_ID for Bedrock, AZURE_TENANT_ID for
MAI’s Entra group, ANTHROPIC_API_KEY for Anthropic. Later entries are
alternates the vendor also honors (GOOGLE_API_KEY,
AWS_DEFAULT_REGION), not a second field.
Empty means the field cannot be supplied from the environment, so a group containing a required field with no variable never resolves from env alone. Server credential resolution ignores this entirely.
Implementations§
Source§impl FormField
impl FormField
Sourcepub fn password(name: impl Into<String>, label: impl Into<String>) -> FormField
pub fn password(name: impl Into<String>, label: impl Into<String>) -> FormField
A masked password/secret field.
Sourcepub fn text(name: impl Into<String>, label: impl Into<String>) -> FormField
pub fn text(name: impl Into<String>, label: impl Into<String>) -> FormField
A plain text field.
Sourcepub fn with_placeholder(self, placeholder: impl Into<String>) -> FormField
pub fn with_placeholder(self, placeholder: impl Into<String>) -> FormField
Set placeholder text.
Sourcepub fn with_help(self, help_text: impl Into<String>) -> FormField
pub fn with_help(self, help_text: impl Into<String>) -> FormField
Set help text shown below the input.
Sourcepub fn with_default(self, default_value: impl Into<String>) -> FormField
pub fn with_default(self, default_value: impl Into<String>) -> FormField
Set a default value the form pre-fills.
Sourcepub fn in_group(self, group: impl Into<String>) -> FormField
pub fn in_group(self, group: impl Into<String>) -> FormField
Assign the field to a mutually-exclusive credential group.
Sourcepub fn env(self, name: impl Into<String>) -> FormField
pub fn env(self, name: impl Into<String>) -> FormField
Declare the environment variable this field is read from, following the vendor’s own SDK convention.
Sourcepub fn env_fallback(self, name: impl Into<String>) -> FormField
pub fn env_fallback(self, name: impl Into<String>) -> FormField
Declare a further variable the vendor also honors, tried after the ones already declared.