appwrite_openapi 1.0.0

AUTO-GENERATED client for Appwrite. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
Documentation
/*
 * Appwrite
 *
 * Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
 *
 * The version of the OpenAPI document: 1.4.9
 * Contact: team@appwrite.io
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct FunctionsCreateRequest {
    /// Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
    #[serde(rename = "functionId")]
    pub function_id: String,
    /// Function name. Max length: 128 chars.
    #[serde(rename = "name")]
    pub name: String,
    /// Execution runtime.
    #[serde(rename = "runtime")]
    pub runtime: Runtime,
    /// An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
    #[serde(rename = "execute", skip_serializing_if = "Option::is_none")]
    pub execute: Option<Vec<String>>,
    /// Events list. Maximum of 100 events are allowed.
    #[serde(rename = "events", skip_serializing_if = "Option::is_none")]
    pub events: Option<Vec<String>>,
    /// Schedule CRON syntax.
    #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")]
    pub schedule: Option<String>,
    /// Function maximum execution time in seconds.
    #[serde(rename = "timeout", skip_serializing_if = "Option::is_none")]
    pub timeout: Option<i32>,
    /// Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none")]
    pub enabled: Option<bool>,
    /// Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
    #[serde(rename = "logging", skip_serializing_if = "Option::is_none")]
    pub logging: Option<bool>,
    /// Entrypoint File. This path is relative to the \"providerRootDirectory\".
    #[serde(rename = "entrypoint", skip_serializing_if = "Option::is_none")]
    pub entrypoint: Option<String>,
    /// Build Commands.
    #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
    pub commands: Option<String>,
    /// Appwrite Installation ID for VCS (Version Control System) deployment.
    #[serde(rename = "installationId", skip_serializing_if = "Option::is_none")]
    pub installation_id: Option<String>,
    /// Repository ID of the repo linked to the function.
    #[serde(rename = "providerRepositoryId", skip_serializing_if = "Option::is_none")]
    pub provider_repository_id: Option<String>,
    /// Production branch for the repo linked to the function.
    #[serde(rename = "providerBranch", skip_serializing_if = "Option::is_none")]
    pub provider_branch: Option<String>,
    /// Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
    #[serde(rename = "providerSilentMode", skip_serializing_if = "Option::is_none")]
    pub provider_silent_mode: Option<bool>,
    /// Path to function code in the linked repo.
    #[serde(rename = "providerRootDirectory", skip_serializing_if = "Option::is_none")]
    pub provider_root_directory: Option<String>,
    /// Repository name of the template.
    #[serde(rename = "templateRepository", skip_serializing_if = "Option::is_none")]
    pub template_repository: Option<String>,
    /// The name of the owner of the template.
    #[serde(rename = "templateOwner", skip_serializing_if = "Option::is_none")]
    pub template_owner: Option<String>,
    /// Path to function code in the template repo.
    #[serde(rename = "templateRootDirectory", skip_serializing_if = "Option::is_none")]
    pub template_root_directory: Option<String>,
    /// Production branch for the repo linked to the function template.
    #[serde(rename = "templateBranch", skip_serializing_if = "Option::is_none")]
    pub template_branch: Option<String>,
}

impl FunctionsCreateRequest {
    pub fn new(function_id: String, name: String, runtime: Runtime) -> FunctionsCreateRequest {
        FunctionsCreateRequest {
            function_id,
            name,
            runtime,
            execute: None,
            events: None,
            schedule: None,
            timeout: None,
            enabled: None,
            logging: None,
            entrypoint: None,
            commands: None,
            installation_id: None,
            provider_repository_id: None,
            provider_branch: None,
            provider_silent_mode: None,
            provider_root_directory: None,
            template_repository: None,
            template_owner: None,
            template_root_directory: None,
            template_branch: None,
        }
    }
}

/// Execution runtime.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Runtime {
    #[serde(rename = "node-18.0")]
    Node18Period0,
    #[serde(rename = "php-8.0")]
    Php8Period0,
    #[serde(rename = "ruby-3.1")]
    Ruby3Period1,
    #[serde(rename = "python-3.9")]
    Python3Period9,
}

impl Default for Runtime {
    fn default() -> Runtime {
        Self::Node18Period0
    }
}