runpod_sdk/model/
pod.rs

1use serde::{Deserialize, Serialize};
2
3use super::common::*;
4
5/// A Pod resource representing a containerized compute instance on RunPod.
6///
7/// Pods are the fundamental compute units in RunPod, providing either GPU or CPU-based
8/// computing resources. They can be configured with various specifications including
9/// compute type, memory, storage, networking, and environment settings.
10///
11/// # Examples
12///
13/// ```rust
14/// use runpod_sdk::model::Pod;
15///
16/// // Pod instances are typically obtained from API responses
17/// // when listing, creating, or retrieving pods
18/// ```
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(rename_all = "camelCase")]
21pub struct Pod {
22    /// A unique string identifying the Pod.
23    pub id: String,
24    /// A user-defined name for the Pod. The name does not need to be unique.
25    pub name: Option<String>,
26    /// The image tag for the container run on the Pod.
27    pub image: String,
28    /// A unique string identifying the RunPod user who rents the Pod.
29    pub consumer_user_id: String,
30    /// A unique string identifying the host machine the Pod is running on.
31    pub machine_id: String,
32    /// The current expected status of the Pod.
33    pub desired_status: PodStatus,
34    /// The cost in RunPod credits per hour of running the Pod.
35    /// Note that the actual cost may be lower if Savings Plans are applied.
36    pub cost_per_hr: f64,
37    /// The effective cost in RunPod credits per hour of running the Pod,
38    /// adjusted by active Savings Plans.
39    pub adjusted_cost_per_hr: f64,
40    /// The number of GPUs attached to the Pod (if it's a GPU Pod).
41    pub gpu_count: Option<i32>,
42    /// The number of virtual CPUs attached to the Pod.
43    pub vcpu_count: f64,
44    /// The amount of RAM, in gigabytes (GB), attached to the Pod.
45    pub memory_in_gb: f64,
46    /// The amount of disk space, in gigabytes (GB), allocated on the container disk.
47    /// The data on the container disk is wiped when the Pod restarts.
48    pub container_disk_in_gb: i32,
49    /// The amount of disk space, in gigabytes (GB), allocated on the Pod volume.
50    /// The data on the Pod volume is persisted across Pod restarts.
51    pub volume_in_gb: Option<i32>,
52    /// The absolute path where the network volume is mounted in the filesystem.
53    pub volume_mount_path: Option<String>,
54    /// Whether the local network volume of the Pod is encrypted.
55    /// Can only be set when creating a Pod.
56    pub volume_encrypted: bool,
57    /// A list of ports exposed on the Pod. Each port is formatted as
58    /// `[port number]/[protocol]`. Protocol can be either `http` or `tcp`.
59    pub ports: Vec<String>,
60    /// A mapping of internal ports to public ports on the Pod.
61    /// For example, `{"22": 10341}` means that port 22 on the Pod is mapped
62    /// to port 10341 and is publicly accessible at `[public ip]:10341`.
63    pub port_mappings: Option<PortMappings>,
64    /// The public IP address of the Pod. If the Pod is still initializing,
65    /// this IP is not yet determined and will be empty.
66    pub public_ip: Option<String>,
67    /// Environment variables for the Pod container.
68    pub env: EnvVars,
69    /// If specified, overrides the ENTRYPOINT for the Docker image run on the Pod.
70    /// If empty, uses the ENTRYPOINT defined in the image.
71    pub docker_entrypoint: Option<Vec<String>>,
72    /// If specified, overrides the start CMD for the Docker image run on the Pod.
73    /// If empty, uses the start CMD defined in the image.
74    pub docker_start_cmd: Option<Vec<String>>,
75    /// Describes how the Pod is rented. An interruptible Pod can be rented at
76    /// a lower cost but can be stopped at any time to free up resources for
77    /// another Pod. A reserved Pod is rented at a higher cost but runs until
78    /// it exits or is manually stopped.
79    pub interruptible: bool,
80    /// Whether the Pod is locked. Locking a Pod disables stopping or resetting it.
81    pub locked: bool,
82    /// GPU information if the Pod has GPUs attached.
83    pub gpu: Option<GpuInfo>,
84    /// If the Pod is a CPU Pod, the unique string identifying the CPU flavor
85    /// the Pod is running on.
86    pub cpu_flavor_id: Option<String>,
87    /// The GPU type ID if the Pod has GPUs attached.
88    pub gpu_type_id: Option<String>,
89    /// If the Pod is created with a template, the unique string identifying that template.
90    pub template_id: Option<String>,
91    /// The unique string identifying the network volume attached to the Pod, if any.
92    pub network_volume_id: Option<String>,
93    /// If the Pod is created with a container registry auth, the unique string
94    /// identifying that container registry auth.
95    pub container_registry_auth_id: Option<String>,
96    /// If the Pod is a Serverless worker, a unique string identifying the
97    /// associated endpoint.
98    pub endpoint_id: Option<String>,
99    /// Synonym for `endpoint_id` (legacy name).
100    pub ai_api_id: Option<String>,
101    /// If the Pod is a Serverless worker, the version of the associated endpoint.
102    pub sls_version: Option<i32>,
103    /// The UTC timestamp when the Pod was last started.
104    pub last_started_at: Option<String>,
105    /// A string describing the last lifecycle event on the Pod.
106    pub last_status_change: Option<String>,
107    /// Information about the machine the Pod is running on.
108    pub machine: Option<Machine>,
109    /// If a network volume is attached to the Pod, information about the network volume.
110    pub network_volume: Option<NetworkVolume>,
111    /// The list of active Savings Plans applied to the Pod. If none are applied, the list is empty.
112    pub savings_plans: Option<Vec<SavingsPlan>>,
113}
114
115/// List of pods.
116pub type Pods = Vec<Pod>;
117
118/// Input parameters for creating a new Pod.
119///
120/// This struct contains all the configuration options available when creating a Pod,
121/// including compute specifications, networking, storage, and deployment preferences.
122/// Most fields are optional and will use RunPod defaults if not specified.
123///
124/// # Examples
125///
126/// ```rust
127/// use runpod_sdk::model::{PodCreateInput, ComputeType, CloudType};
128///
129/// let create_input = PodCreateInput {
130///     name: Some("my-pod".to_string()),
131///     image_name: Some("runpod/pytorch:latest".to_string()),
132///     compute_type: Some(ComputeType::Gpu),
133///     cloud_type: Some(CloudType::Secure),
134///     ..Default::default()
135/// };
136/// ```
137#[derive(Debug, Clone, Default, Serialize, Deserialize)]
138#[serde(rename_all = "camelCase")]
139pub struct PodCreateInput {
140    /// If the created Pod is a GPU Pod, a list of acceptable CUDA versions.
141    /// If not set, any CUDA version is acceptable.
142    #[serde(skip_serializing_if = "Option::is_none")]
143    pub allowed_cuda_versions: Option<Vec<CudaVersion>>,
144    /// Set to `SECURE` to create the Pod in Secure Cloud. Set to `COMMUNITY`
145    /// to create the Pod in Community Cloud.
146    #[serde(skip_serializing_if = "Option::is_none")]
147    pub cloud_type: Option<CloudType>,
148    /// Set to `GPU` to create a GPU Pod. Set to `CPU` to create a CPU Pod.
149    /// If set to `CPU`, the Pod will not have a GPU attached and GPU-related
150    /// properties will be ignored.
151    #[serde(skip_serializing_if = "Option::is_none")]
152    pub compute_type: Option<ComputeType>,
153    /// The amount of disk space, in gigabytes (GB), to allocate on the container disk.
154    /// The data on the container disk is wiped when the Pod restarts.
155    #[serde(skip_serializing_if = "Option::is_none")]
156    pub container_disk_in_gb: Option<i32>,
157    /// Registry credentials ID for private container registries.
158    #[serde(skip_serializing_if = "Option::is_none")]
159    pub container_registry_auth_id: Option<String>,
160    /// A list of country codes where the created Pod can be located.
161    /// If not set, the Pod can be located in any country.
162    #[serde(skip_serializing_if = "Option::is_none")]
163    pub country_codes: Option<Vec<String>>,
164    /// If the created Pod is a CPU Pod, a list of RunPod CPU flavors which
165    /// can be attached to the Pod. The order determines the rental priority.
166    #[serde(skip_serializing_if = "Option::is_none")]
167    pub cpu_flavor_ids: Option<Vec<CpuFlavorId>>,
168    /// If the created Pod is a CPU Pod, set to `availability` to respond to
169    /// current CPU flavor availability. Set to `custom` to always try to rent
170    /// CPU flavors in the order specified in `cpu_flavor_ids`.
171    #[serde(skip_serializing_if = "Option::is_none")]
172    pub cpu_flavor_priority: Option<String>,
173    /// A list of RunPod data center IDs where the created Pod can be located.
174    #[serde(skip_serializing_if = "Option::is_none")]
175    pub data_center_ids: Option<Vec<DataCenterId>>,
176    /// Set to `availability` to respond to current machine availability.
177    /// Set to `custom` to always try to rent machines from data centers
178    /// in the order specified in `data_center_ids`.
179    #[serde(skip_serializing_if = "Option::is_none")]
180    pub data_center_priority: Option<String>,
181    /// If specified, overrides the ENTRYPOINT for the Docker image.
182    /// If empty, uses the ENTRYPOINT defined in the image.
183    #[serde(skip_serializing_if = "Option::is_none")]
184    pub docker_entrypoint: Option<Vec<String>>,
185    /// If specified, overrides the start CMD for the Docker image.
186    /// If empty, uses the start CMD defined in the image.
187    #[serde(skip_serializing_if = "Option::is_none")]
188    pub docker_start_cmd: Option<Vec<String>>,
189    /// Environment variables for the Pod container.
190    #[serde(skip_serializing_if = "Option::is_none")]
191    pub env: Option<EnvVars>,
192    /// Set to true to enable global networking for the created Pod.
193    /// Currently only available for On-Demand GPU Pods on some Secure Cloud data centers.
194    #[serde(skip_serializing_if = "Option::is_none")]
195    pub global_networking: Option<bool>,
196    /// If the created Pod is a GPU Pod, the number of GPUs attached to the Pod.
197    #[serde(skip_serializing_if = "Option::is_none")]
198    pub gpu_count: Option<i32>,
199    /// If the created Pod is a GPU Pod, a list of RunPod GPU types which
200    /// can be attached to the Pod. The order determines the rental priority.
201    #[serde(skip_serializing_if = "Option::is_none")]
202    pub gpu_type_ids: Option<Vec<GpuTypeId>>,
203    /// If the created Pod is a GPU Pod, set to `availability` to respond to
204    /// current GPU type availability. Set to `custom` to always try to rent
205    /// GPU types in the order specified in `gpu_type_ids`.
206    #[serde(skip_serializing_if = "Option::is_none")]
207    pub gpu_type_priority: Option<String>,
208    /// The image tag for the container run on the created Pod.
209    #[serde(skip_serializing_if = "Option::is_none")]
210    pub image_name: Option<String>,
211    /// Set to true to create an interruptible or spot Pod. An interruptible Pod
212    /// can be rented at a lower cost but can be stopped at any time to free up
213    /// resources for another Pod.
214    #[serde(skip_serializing_if = "Option::is_none")]
215    pub interruptible: Option<bool>,
216    /// Set to true to lock the Pod. Locking a Pod disables stopping or resetting it.
217    #[serde(skip_serializing_if = "Option::is_none")]
218    pub locked: Option<bool>,
219    /// The minimum disk bandwidth, in megabytes per second (MBps), for the created Pod.
220    #[serde(skip_serializing_if = "Option::is_none")]
221    pub min_disk_bandwidth_m_bps: Option<f64>,
222    /// The minimum download speed, in megabits per second (Mbps), for the created Pod.
223    #[serde(skip_serializing_if = "Option::is_none")]
224    pub min_download_mbps: Option<f64>,
225    /// If the created Pod is a GPU Pod, the minimum amount of RAM, in gigabytes (GB),
226    /// allocated to the Pod for each GPU attached.
227    #[serde(skip_serializing_if = "Option::is_none")]
228    pub min_ram_per_gpu: Option<i32>,
229    /// The minimum upload speed, in megabits per second (Mbps), for the created Pod.
230    #[serde(skip_serializing_if = "Option::is_none")]
231    pub min_upload_mbps: Option<f64>,
232    /// If the created Pod is a GPU Pod, the minimum number of virtual CPUs
233    /// allocated to the Pod for each GPU attached.
234    #[serde(skip_serializing_if = "Option::is_none")]
235    pub min_vcpu_per_gpu: Option<i32>,
236    /// A user-defined name for the created Pod. The name does not need to be unique.
237    #[serde(skip_serializing_if = "Option::is_none")]
238    pub name: Option<String>,
239    /// The unique string identifying the network volume to attach to the created Pod.
240    /// If attached, a network volume replaces the Pod network volume.
241    #[serde(skip_serializing_if = "Option::is_none")]
242    pub network_volume_id: Option<String>,
243    /// A list of ports exposed on the created Pod. Each port is formatted as
244    /// `[port number]/[protocol]`. Protocol can be either `http` or `tcp`.
245    #[serde(skip_serializing_if = "Option::is_none")]
246    pub ports: Option<Vec<String>>,
247    /// If the created Pod is on Community Cloud, set to true if you need the Pod
248    /// to expose a public IP address. On Secure Cloud, the Pod will always have
249    /// a public IP address.
250    #[serde(skip_serializing_if = "Option::is_none")]
251    pub support_public_ip: Option<bool>,
252    /// If the Pod is created with a template, the unique string identifying that template.
253    #[serde(skip_serializing_if = "Option::is_none")]
254    pub template_id: Option<String>,
255    /// If the created Pod is a CPU Pod, the number of vCPUs allocated to the Pod.
256    #[serde(skip_serializing_if = "Option::is_none")]
257    pub vcpu_count: Option<i32>,
258    /// The amount of disk space, in gigabytes (GB), to allocate on the Pod volume.
259    /// The data on the Pod volume is persisted across Pod restarts.
260    #[serde(skip_serializing_if = "Option::is_none")]
261    pub volume_in_gb: Option<i32>,
262    /// The absolute path where the network volume will be mounted in the filesystem.
263    #[serde(skip_serializing_if = "Option::is_none")]
264    pub volume_mount_path: Option<String>,
265}
266
267/// Input parameters for updating an existing Pod.
268///
269/// This struct contains the configuration options that can be modified for
270/// an existing Pod. Note that updating a Pod will trigger a reset.
271///
272/// # Examples
273///
274/// ```rust
275/// use runpod_sdk::model::PodUpdateInput;
276///
277/// let update_input = PodUpdateInput {
278///     name: Some("updated-pod-name".to_string()),
279///     locked: Some(true),
280///     ..Default::default()
281/// };
282/// ```
283#[derive(Debug, Clone, Default, Serialize, Deserialize)]
284#[serde(rename_all = "camelCase")]
285pub struct PodUpdateInput {
286    /// The amount of disk space, in gigabytes (GB), to allocate on the container disk.
287    /// The data on the container disk is wiped when the Pod restarts.
288    #[serde(skip_serializing_if = "Option::is_none")]
289    pub container_disk_in_gb: Option<i32>,
290    /// Registry credentials ID for private container registries.
291    #[serde(skip_serializing_if = "Option::is_none")]
292    pub container_registry_auth_id: Option<String>,
293    /// If specified, overrides the ENTRYPOINT for the Docker image.
294    /// If empty, uses the ENTRYPOINT defined in the image.
295    #[serde(skip_serializing_if = "Option::is_none")]
296    pub docker_entrypoint: Option<Vec<String>>,
297    /// If specified, overrides the start CMD for the Docker image.
298    /// If empty, uses the start CMD defined in the image.
299    #[serde(skip_serializing_if = "Option::is_none")]
300    pub docker_start_cmd: Option<Vec<String>>,
301    /// Environment variables for the Pod container.
302    #[serde(skip_serializing_if = "Option::is_none")]
303    pub env: Option<EnvVars>,
304    /// Set to true to enable global networking for the Pod.
305    /// Currently only available for On-Demand GPU Pods on some Secure Cloud data centers.
306    #[serde(skip_serializing_if = "Option::is_none")]
307    pub global_networking: Option<bool>,
308    /// The image tag for the container run on the Pod.
309    #[serde(skip_serializing_if = "Option::is_none")]
310    pub image_name: Option<String>,
311    /// Set to true to lock the Pod. Locking a Pod disables stopping or resetting it.
312    #[serde(skip_serializing_if = "Option::is_none")]
313    pub locked: Option<bool>,
314    /// A user-defined name for the Pod. The name does not need to be unique.
315    #[serde(skip_serializing_if = "Option::is_none")]
316    pub name: Option<String>,
317    /// A list of ports exposed on the Pod. Each port is formatted as
318    /// `[port number]/[protocol]`. Protocol can be either `http` or `tcp`.
319    #[serde(skip_serializing_if = "Option::is_none")]
320    pub ports: Option<Vec<String>>,
321    /// The amount of disk space, in gigabytes (GB), to allocate on the Pod volume.
322    /// The data on the Pod volume is persisted across Pod restarts.
323    #[serde(skip_serializing_if = "Option::is_none")]
324    pub volume_in_gb: Option<i32>,
325    /// The absolute path where the network volume will be mounted in the filesystem.
326    #[serde(skip_serializing_if = "Option::is_none")]
327    pub volume_mount_path: Option<String>,
328}
329
330/// Query parameters for filtering and configuring Pod list operations.
331///
332/// This struct provides various filters and options for customizing the
333/// response when listing Pods.
334///
335/// # Examples
336///
337/// ```rust
338/// use runpod_sdk::model::{ListPodsQuery, ComputeType, PodStatus};
339///
340/// let query = ListPodsQuery {
341///     compute_type: Some(ComputeType::Gpu),
342///     desired_status: Some(PodStatus::Running),
343///     include_machine: Some(true),
344///     ..Default::default()
345/// };
346/// ```
347#[derive(Debug, Clone, Default, Serialize)]
348#[serde(rename_all = "camelCase")]
349pub struct ListPodsQuery {
350    /// Filter to only GPU or only CPU Pods.
351    #[serde(skip_serializing_if = "Option::is_none")]
352    pub compute_type: Option<ComputeType>,
353    /// Filter to CPU Pods with any of the listed CPU flavors.
354    #[serde(skip_serializing_if = "Option::is_none")]
355    pub cpu_flavor_id: Option<Vec<CpuFlavorId>>,
356    /// Filter to Pods located in any of the provided RunPod data centers.
357    #[serde(skip_serializing_if = "Option::is_none")]
358    pub data_center_id: Option<Vec<DataCenterId>>,
359    /// Filter to Pods currently in the provided state.
360    #[serde(skip_serializing_if = "Option::is_none")]
361    pub desired_status: Option<PodStatus>,
362    /// Filter to workers on the provided Serverless endpoint.
363    /// Note that endpoint workers are not included in the response by default.
364    #[serde(skip_serializing_if = "Option::is_none")]
365    pub endpoint_id: Option<String>,
366    /// Filter to Pods with any of the listed GPU types attached.
367    #[serde(skip_serializing_if = "Option::is_none")]
368    pub gpu_type_id: Option<Vec<GpuTypeId>>,
369    /// Filter to a specific Pod.
370    #[serde(skip_serializing_if = "Option::is_none")]
371    pub id: Option<String>,
372    /// Filter to Pods created with the provided image.
373    #[serde(skip_serializing_if = "Option::is_none")]
374    pub image_name: Option<String>,
375    /// Include information about the machine the Pod is running on.
376    #[serde(skip_serializing_if = "Option::is_none")]
377    pub include_machine: Option<bool>,
378    /// Include information about the network volume attached to the Pod, if any.
379    #[serde(skip_serializing_if = "Option::is_none")]
380    pub include_network_volume: Option<bool>,
381    /// Include information about the savings plans applied to the Pod.
382    #[serde(skip_serializing_if = "Option::is_none")]
383    pub include_savings_plans: Option<bool>,
384    /// Include information about the template the Pod uses, if any.
385    #[serde(skip_serializing_if = "Option::is_none")]
386    pub include_template: Option<bool>,
387    /// Set to true to also list Pods which are Serverless workers.
388    #[serde(skip_serializing_if = "Option::is_none")]
389    pub include_workers: Option<bool>,
390    /// Filter to Pods with the provided name.
391    #[serde(skip_serializing_if = "Option::is_none")]
392    pub name: Option<String>,
393    /// Filter to Pods with the provided network volume attached.
394    #[serde(skip_serializing_if = "Option::is_none")]
395    pub network_volume_id: Option<String>,
396    /// Filter to Pods created from the provided template.
397    #[serde(skip_serializing_if = "Option::is_none")]
398    pub template_id: Option<String>,
399}
400
401/// Query parameters for retrieving a single Pod.
402///
403/// This struct provides options for customizing the response when retrieving
404/// a specific Pod by ID.
405///
406/// # Examples
407///
408/// ```rust
409/// use runpod_sdk::model::GetPodQuery;
410///
411/// let query = GetPodQuery {
412///     include_machine: Some(true),
413///     include_network_volume: Some(true),
414///     include_savings_plans: Some(true),
415///     ..Default::default()
416/// };
417/// ```
418#[derive(Debug, Clone, Default, Serialize)]
419#[serde(rename_all = "camelCase")]
420pub struct GetPodQuery {
421    /// Include information about the machine the Pod is running on.
422    #[serde(skip_serializing_if = "Option::is_none")]
423    pub include_machine: Option<bool>,
424    /// Include information about the network volume attached to the returned Pod, if any.
425    #[serde(skip_serializing_if = "Option::is_none")]
426    pub include_network_volume: Option<bool>,
427    /// Include information about the savings plans applied to the Pod.
428    #[serde(skip_serializing_if = "Option::is_none")]
429    pub include_savings_plans: Option<bool>,
430    /// Include information about the template the Pod uses, if any.
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub include_template: Option<bool>,
433    /// Set to true to also list Pods which are Serverless workers.
434    #[serde(skip_serializing_if = "Option::is_none")]
435    pub include_workers: Option<bool>,
436}