runpod_sdk/model/registry.rs
1use serde::{Deserialize, Serialize};
2
3/// Container registry authentication credentials.
4///
5/// Represents stored authentication credentials for accessing private container registries.
6/// These credentials enable RunPod to pull private Docker images during Pod and Serverless
7/// endpoint deployment.
8///
9/// # Security Notice
10///
11/// This struct only contains non-sensitive information. Actual passwords and tokens
12/// are securely stored by RunPod and never returned in API responses.
13///
14/// # Usage
15///
16/// Authentication records are typically referenced by their ID when creating Pods or
17/// Serverless endpoints that require access to private container images.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(rename_all = "camelCase")]
20pub struct ContainerRegistryAuth {
21 /// A unique string identifying the container registry authentication.
22 /// This ID is used to reference the authentication when creating Pods or endpoints.
23 pub id: String,
24
25 /// A user-defined name for the container registry authentication.
26 /// The name must be unique within your RunPod account and should be descriptive
27 /// enough to identify the registry or purpose (e.g., "production-ecr", "my-dockerhub").
28 pub name: String,
29}
30
31/// Collection of container registry authentication records.
32///
33/// This type alias represents the standard response format when listing
34/// container registry authentications, containing an array of [`ContainerRegistryAuth`] instances.
35pub type ContainerRegistryAuths = Vec<ContainerRegistryAuth>;
36
37/// Input parameters for creating new container registry authentication.
38///
39/// Use this struct to provide the necessary credentials for accessing a private container registry.
40/// All fields are required to establish authentication with the registry.
41///
42/// # Security Best Practices
43///
44/// - Use registry-specific access tokens instead of account passwords when available
45/// - Ensure the username and password/token combination has the minimum required permissions
46/// - Use descriptive names that help identify the registry and intended use case
47/// - Regularly rotate credentials to maintain security
48///
49/// # Registry-Specific Examples
50///
51/// ## Docker Hub
52/// ```rust
53/// # use runpod_sdk::model::ContainerRegistryAuthCreateInput;
54/// let docker_hub_auth = ContainerRegistryAuthCreateInput {
55/// name: "dockerhub-production".to_string(),
56/// username: "myusername".to_string(),
57/// password: "dckr_pat_1234567890abcdef".to_string(), // Docker access token
58/// };
59/// ```
60///
61/// ## AWS ECR
62/// ```rust
63/// # use runpod_sdk::model::ContainerRegistryAuthCreateInput;
64/// let ecr_auth = ContainerRegistryAuthCreateInput {
65/// name: "aws-ecr-us-west-2".to_string(),
66/// username: "AWS".to_string(),
67/// password: "eyJwYXlsb2FkIjoi...".to_string(), // ECR authorization token
68/// };
69/// ```
70///
71/// ## GitHub Container Registry
72/// ```rust
73/// # use runpod_sdk::model::ContainerRegistryAuthCreateInput;
74/// let ghcr_auth = ContainerRegistryAuthCreateInput {
75/// name: "github-packages".to_string(),
76/// username: "myusername".to_string(),
77/// password: "ghp_1234567890abcdef".to_string(), // GitHub personal access token
78/// };
79/// ```
80#[derive(Debug, Clone, Default, Serialize, Deserialize)]
81#[serde(rename_all = "camelCase")]
82pub struct ContainerRegistryAuthCreateInput {
83 /// A user-defined name for the container registry authentication.
84 /// The name must be unique within your RunPod account. Choose a descriptive
85 /// name that identifies the registry and its intended use case.
86 ///
87 /// Examples: "production-ecr", "staging-dockerhub", "private-harbor"
88 pub name: String,
89
90 /// The username for authenticating with the container registry.
91 /// This varies by registry type:
92 /// - Docker Hub: Your Docker Hub username
93 /// - AWS ECR: Always "AWS"
94 /// - GitHub Container Registry: Your GitHub username
95 /// - Google Container Registry: "_json_key" for service account authentication
96 pub username: String,
97
98 /// The password, token, or credential for authenticating with the container registry.
99 /// For enhanced security, use registry-specific access tokens when available:
100 /// - Docker Hub: Use access tokens instead of passwords
101 /// - AWS ECR: Use ECR authorization tokens
102 /// - GitHub: Use personal access tokens with package permissions
103 /// - Google GCR: Use service account JSON key (as string) for the password
104 pub password: String,
105}