fastly_api/models/arc_provider_connection_api_key.rs
1/*
2 * Fastly API
3 *
4 * Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
5 *
6 */
7
8/// ArcProviderConnectionApiKey : A provider connection authenticated with the provider's own API key.
9
10
11
12#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
13pub struct ArcProviderConnectionApiKey {
14 /// A display name for the provider connection. Cannot match a name reserved by a built-in provider.
15 #[serde(rename = "name")]
16 pub name: String,
17 /// The AI model identifiers this connection is allowed to use.
18 #[serde(rename = "models")]
19 pub models: Vec<String>,
20 /// The base URL of the provider's API. Must be an absolute `http` or `https` URL and must not end in `/v1`.
21 #[serde(rename = "base_url")]
22 pub base_url: String,
23 /// The provider's secret API key.
24 #[serde(rename = "api_key")]
25 pub api_key: String,
26 /// The authentication type for this connection. Omit for the default `api-key` behavior.
27 #[serde(rename = "auth_type", skip_serializing_if = "Option::is_none")]
28 pub auth_type: Option<AuthType>,
29}
30
31impl ArcProviderConnectionApiKey {
32 /// A provider connection authenticated with the provider's own API key.
33 pub fn new(name: String, models: Vec<String>, base_url: String, api_key: String) -> ArcProviderConnectionApiKey {
34 ArcProviderConnectionApiKey {
35 name,
36 models,
37 base_url,
38 api_key,
39 auth_type: None,
40 }
41 }
42}
43
44/// The authentication type for this connection. Omit for the default `api-key` behavior.
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum AuthType {
47 #[serde(rename = "api-key")]
48 ApiKey,
49}
50
51impl Default for AuthType {
52 fn default() -> AuthType {
53 Self::ApiKey
54 }
55}
56