hcloud 0.25.0

Unofficial Rust crate for accessing the Hetzner Cloud API
Documentation
/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 0.28.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

/// CreateFirewallRequest : Request for POST https://api.hetzner.cloud/v1/firewalls
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateFirewallRequest {
    /// Resources to apply the Firewall to.  Resources added directly are taking precedence over those added via a Label Selector.
    #[serde(rename = "apply_to", skip_serializing_if = "Option::is_none")]
    pub apply_to: Option<Vec<models::FirewallResource>>,
    /// User-defined labels (`key/value` pairs) for the Resource. For more information, see \"Labels\".  | User-defined labels (`key/value` pairs) for the Resource.  Note that the set of Labels provided in the request will overwrite the existing one.  For more information, see \"Labels\".
    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// Name of the Firewall.  Limited to a maximum of 128 characters.  Must be unique per Project.
    #[serde(rename = "name")]
    pub name: String,
    /// Array of rules.  Rules are limited to 50 entries per Firewall and [500 effective rules](https://docs.hetzner.com/cloud/firewalls/overview#limits).
    #[serde(rename = "rules", skip_serializing_if = "Option::is_none")]
    pub rules: Option<Vec<models::Rule>>,
}

impl CreateFirewallRequest {
    /// Request for POST https://api.hetzner.cloud/v1/firewalls
    pub fn new(name: String) -> CreateFirewallRequest {
        CreateFirewallRequest {
            apply_to: None,
            labels: None,
            name,
            rules: None,
        }
    }
}