Skip to main content

gproxy_protocol/aws/
types.rs

1use serde::{Deserialize, Serialize};
2
3pub type Rest = serde_json::Map<String, serde_json::Value>;
4
5#[derive(
6    Debug,
7    Clone,
8    PartialEq,
9    Eq,
10    Serialize,
11    Deserialize,
12    Default,
13    gproxy_protocol_macros::WireBuilder,
14)]
15#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
16pub struct EmptyObject {
17    #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
18    pub rest: Rest,
19}
20
21macro_rules! extensible_string_enum {
22    ($outer:ident, $known:ident { $($variant:ident => $wire:literal),+ $(,)? }) => {
23        #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
24        #[serde(untagged)]
25        #[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
26        pub enum $outer {
27            Known($known),
28            Unknown(String),
29        }
30
31        #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
32        #[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
33        pub enum $known {
34            $(#[serde(rename = $wire)] $variant),+
35        }
36    };
37}
38
39extensible_string_enum!(ConversationRole, ConversationRoleKnown {
40    User => "user", Assistant => "assistant", System => "system",
41});
42extensible_string_enum!(StopReason, StopReasonKnown {
43    EndTurn => "end_turn", ToolUse => "tool_use", MaxTokens => "max_tokens",
44    StopSequence => "stop_sequence", GuardrailIntervened => "guardrail_intervened",
45    ContentFiltered => "content_filtered", MalformedModelOutput => "malformed_model_output",
46    MalformedToolUse => "malformed_tool_use",
47    ModelContextWindowExceeded => "model_context_window_exceeded",
48});
49extensible_string_enum!(ServiceTierType, ServiceTierTypeKnown {
50    Priority => "priority", Default => "default", Flex => "flex", Reserved => "reserved",
51});
52extensible_string_enum!(PerformanceLatency, PerformanceLatencyKnown {
53    Standard => "standard", Optimized => "optimized",
54});
55extensible_string_enum!(CachePointType, CachePointTypeKnown { Default => "default" });
56extensible_string_enum!(CacheTtl, CacheTtlKnown { FiveMinutes => "5m", OneHour => "1h" });
57extensible_string_enum!(ToolResultStatus, ToolResultStatusKnown {
58    Success => "success", Error => "error",
59});
60extensible_string_enum!(ToolUseType, ToolUseTypeKnown {
61    ServerToolUse => "server_tool_use",
62});
63extensible_string_enum!(GuardrailTrace, GuardrailTraceKnown {
64    Enabled => "enabled", Disabled => "disabled", EnabledFull => "enabled_full",
65});
66extensible_string_enum!(GuardrailStreamProcessingMode, GuardrailStreamProcessingModeKnown {
67    Sync => "sync", Async => "async",
68});
69extensible_string_enum!(GuardrailOrigin, GuardrailOriginKnown {
70    Request => "REQUEST", AccountEnforced => "ACCOUNT_ENFORCED",
71    OrganizationEnforced => "ORGANIZATION_ENFORCED",
72});
73extensible_string_enum!(GuardrailOwnership, GuardrailOwnershipKnown {
74    SelfOwned => "SELF", CrossAccount => "CROSS_ACCOUNT",
75});
76extensible_string_enum!(GuardrailBlockAction, GuardrailBlockActionKnown {
77    Blocked => "BLOCKED", None => "NONE",
78});
79extensible_string_enum!(GuardrailSensitiveAction, GuardrailSensitiveActionKnown {
80    Anonymized => "ANONYMIZED", Blocked => "BLOCKED", None => "NONE",
81});
82extensible_string_enum!(GuardrailLevel, GuardrailLevelKnown {
83    None => "NONE", Low => "LOW", Medium => "MEDIUM", High => "HIGH",
84});
85extensible_string_enum!(GuardrailContentFilterType, GuardrailContentFilterTypeKnown {
86    Insults => "INSULTS", Hate => "HATE", Sexual => "SEXUAL", Violence => "VIOLENCE",
87    Misconduct => "MISCONDUCT", PromptAttack => "PROMPT_ATTACK",
88});
89extensible_string_enum!(
90    GuardrailContextualGroundingFilterType, GuardrailContextualGroundingFilterTypeKnown {
91        Grounding => "GROUNDING", Relevance => "RELEVANCE",
92    }
93);
94extensible_string_enum!(GuardrailTopicType, GuardrailTopicTypeKnown { Deny => "DENY" });
95extensible_string_enum!(GuardrailManagedWordType, GuardrailManagedWordTypeKnown {
96    Profanity => "PROFANITY",
97});
98extensible_string_enum!(
99    GuardrailAutomatedReasoningLogicWarningType,
100    GuardrailAutomatedReasoningLogicWarningTypeKnown {
101        AlwaysFalse => "ALWAYS_FALSE", AlwaysTrue => "ALWAYS_TRUE",
102    }
103);
104extensible_string_enum!(GuardrailPiiEntityType, GuardrailPiiEntityTypeKnown {
105    Address => "ADDRESS", Age => "AGE", AwsAccessKey => "AWS_ACCESS_KEY",
106    AwsSecretKey => "AWS_SECRET_KEY", CaHealthNumber => "CA_HEALTH_NUMBER",
107    CaSocialInsuranceNumber => "CA_SOCIAL_INSURANCE_NUMBER",
108    CreditDebitCardCvv => "CREDIT_DEBIT_CARD_CVV",
109    CreditDebitCardExpiry => "CREDIT_DEBIT_CARD_EXPIRY",
110    CreditDebitCardNumber => "CREDIT_DEBIT_CARD_NUMBER", DriverId => "DRIVER_ID",
111    Email => "EMAIL", InternationalBankAccountNumber => "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
112    IpAddress => "IP_ADDRESS", LicensePlate => "LICENSE_PLATE", MacAddress => "MAC_ADDRESS",
113    Name => "NAME", Password => "PASSWORD", Phone => "PHONE", Pin => "PIN",
114    SwiftCode => "SWIFT_CODE", UkNationalHealthServiceNumber => "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
115    UkNationalInsuranceNumber => "UK_NATIONAL_INSURANCE_NUMBER",
116    UkUniqueTaxpayerReferenceNumber => "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER", Url => "URL",
117    Username => "USERNAME", UsBankAccountNumber => "US_BANK_ACCOUNT_NUMBER",
118    UsBankRoutingNumber => "US_BANK_ROUTING_NUMBER",
119    UsIndividualTaxIdentificationNumber => "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
120    UsPassportNumber => "US_PASSPORT_NUMBER", UsSocialSecurityNumber => "US_SOCIAL_SECURITY_NUMBER",
121    VehicleIdentificationNumber => "VEHICLE_IDENTIFICATION_NUMBER",
122});
123extensible_string_enum!(OutputFormatType, OutputFormatTypeKnown {
124    JsonSchema => "json_schema",
125});
126extensible_string_enum!(ImageFormat, ImageFormatKnown {
127    Png => "png", Jpeg => "jpeg", Gif => "gif", Webp => "webp",
128});
129extensible_string_enum!(DocumentFormat, DocumentFormatKnown {
130    Pdf => "pdf", Csv => "csv", Doc => "doc", Docx => "docx", Xls => "xls",
131    Xlsx => "xlsx", Html => "html", Txt => "txt", Md => "md",
132});
133extensible_string_enum!(AsyncInvokeStatus, AsyncInvokeStatusKnown {
134    InProgress => "InProgress", Completed => "Completed", Failed => "Failed",
135});
136extensible_string_enum!(CustomizationType, CustomizationTypeKnown {
137    FineTuning => "FINE_TUNING", ContinuedPreTraining => "CONTINUED_PRE_TRAINING",
138    Distillation => "DISTILLATION",
139});
140extensible_string_enum!(InferenceType, InferenceTypeKnown {
141    OnDemand => "ON_DEMAND", Provisioned => "PROVISIONED",
142});
143extensible_string_enum!(ModelModality, ModelModalityKnown {
144    Text => "TEXT", Image => "IMAGE", Embedding => "EMBEDDING",
145});
146extensible_string_enum!(FoundationModelLifecycleStatus, FoundationModelLifecycleStatusKnown {
147    Active => "ACTIVE", Legacy => "LEGACY",
148});