tapis-pods 0.3.1

The Pods Service is a web service and distributed computing platform providing pods-as-a-service (PaaS). The service implements a message broker and processor model that requests pods, alongside a health module to poll for pod data, including logs, status, and health. The primary use of this service is to have quick to deploy long-lived services based on Docker images that are exposed via HTTP or TCP endpoints listed by the API. **The Pods service provides functionality for two types of pod solutions:** * **Templated Pods** for run-as-is popular images. Neo4J is one example, the template manages TCP ports, user creation, and permissions. * **Custom Pods** for arbitrary docker images with less functionality. In this case we will expose port 5000 and do nothing else. The live-docs act as the most up-to-date API reference. Visit the [documentation for more information](https://tapis.readthedocs.io/en/latest/technical/pods.html).
Documentation
/*
 * Tapis Pods Service
 *
 *  The Pods Service is a web service and distributed computing platform providing pods-as-a-service (PaaS). The service  implements a message broker and processor model that requests pods, alongside a health module to poll for pod data, including logs, status, and health. The primary use of this service is to have quick to deploy long-lived services based on Docker images that are exposed via HTTP or TCP endpoints listed by the API.  **The Pods service provides functionality for two types of pod solutions:**  * **Templated Pods** for run-as-is popular images. Neo4J is one example, the template manages TCP ports, user creation, and permissions.  * **Custom Pods** for arbitrary docker images with less functionality. In this case we will expose port 5000 and do nothing else.   The live-docs act as the most up-to-date API reference. Visit the [documentation for more information](https://tapis.readthedocs.io/en/latest/technical/pods.html).
 *
 * The version of the OpenAPI document: 26Q1.1
 * Contact: cicsupport@tacc.utexas.edu
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// NewPod : Object with fields that users are allowed to specify for the Pod class.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NewPod {
    /// Name of this pod.
    #[serde(rename = "pod_id")]
    pub pod_id: String,
    /// Which docker image to use, must be on allowlist, check /pods/images for list.
    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
    pub image: Option<String>,
    /// Which pod template to use as base of pod fields. User set attributes will overwrite template fields.
    #[serde(rename = "template", skip_serializing_if = "Option::is_none")]
    pub template: Option<String>,
    /// Description of this pod.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(
        rename = "command",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub command: Option<Option<Vec<String>>>,
    #[serde(
        rename = "arguments",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub arguments: Option<Option<Vec<String>>>,
    /// Environment variables to inject into k8 pod. Use `${pods:secrets:KEY}` to reference secret_map entries.
    #[serde(
        rename = "environment_variables",
        skip_serializing_if = "Option::is_none"
    )]
    pub environment_variables: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// Map of keys to secret values. Syntax: ${secret:name} (user secret), ${secret:user:name} (explicit owner). Reference in environment_variables via ${pods:secrets:KEY}. Resolved at pod start.
    #[serde(rename = "secret_map", skip_serializing_if = "Option::is_none")]
    pub secret_map: Option<std::collections::HashMap<String, String>>,
    /// Status requested by user, `ON`, `OFF`, or `RESTART`.
    #[serde(rename = "status_requested", skip_serializing_if = "Option::is_none")]
    pub status_requested: Option<String>,
    /// Volume mounts keyed by mount_path. Values are VolumeMount objects (see schema) or null (to remove inherited mount). Ex: {\"/data\": {\"type\": \"tapisvolume\", \"source_id\": \"myvolume\"}, \"/etc/config.ini\": {\"type\": \"ephemeral\", \"config_content\": \"key=value\"}}
    #[serde(rename = "volume_mounts", skip_serializing_if = "Option::is_none")]
    pub volume_mounts: Option<std::collections::HashMap<String, models::VolumeMountsValue>>,
    /// Default time (sec) for pod to run from instance start. -1 for unlimited. 12 hour default.
    #[serde(
        rename = "time_to_stop_default",
        skip_serializing_if = "Option::is_none"
    )]
    pub time_to_stop_default: Option<i32>,
    #[serde(
        rename = "time_to_stop_instance",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub time_to_stop_instance: Option<Option<i32>>,
    /// Networking information. `{\"url_suffix\": {\"protocol\": \"http\"  \"tcp\", \"port\": int}}`
    #[serde(rename = "networking", skip_serializing_if = "Option::is_none")]
    pub networking: Option<std::collections::HashMap<String, models::Networking>>,
    /// Pod resource management `{\"cpu_limit\": 3000, \"mem_limit\": 3000, \"cpu_request\": 500, \"mem_limit\": 500, \"gpus\": 0}`
    #[serde(rename = "resources", skip_serializing_if = "Option::is_none")]
    pub resources: Option<Box<models::ModelsPodsResources>>,
    /// Queue to run pod in. `default` is the default queue.
    #[serde(rename = "compute_queue", skip_serializing_if = "Option::is_none")]
    pub compute_queue: Option<String>,
    #[serde(
        rename = "template_overrides",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub template_overrides: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
}

impl NewPod {
    /// Object with fields that users are allowed to specify for the Pod class.
    pub fn new(pod_id: String) -> NewPod {
        NewPod {
            pod_id,
            image: None,
            template: None,
            description: None,
            command: None,
            arguments: None,
            environment_variables: None,
            secret_map: None,
            status_requested: None,
            volume_mounts: None,
            time_to_stop_default: None,
            time_to_stop_instance: None,
            networking: None,
            resources: None,
            compute_queue: None,
            template_overrides: None,
        }
    }
}