hcloud/models/
create_load_balancer_request.rs

1/*
2 * Hetzner Cloud API
3 *
4 * Copied from the official API documentation for the Public Hetzner Cloud.
5 *
6 * The version of the OpenAPI document: 0.28.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CreateLoadBalancerRequest : Request for POST https://api.hetzner.cloud/v1/load_balancers
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateLoadBalancerRequest {
17    #[serde(rename = "algorithm", skip_serializing_if = "Option::is_none")]
18    pub algorithm: Option<Box<models::LoadBalancerAlgorithm>>,
19    /// 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\".
20    #[serde(rename = "labels", skip_serializing_if = "Option::is_none")]
21    pub labels: Option<std::collections::HashMap<String, String>>,
22    /// ID or name of the Load Balancer type this Load Balancer should be created with.
23    #[serde(rename = "load_balancer_type")]
24    pub load_balancer_type: String,
25    /// ID or name of Location to create Load Balancer in.
26    #[serde(rename = "location", skip_serializing_if = "Option::is_none")]
27    pub location: Option<String>,
28    /// Name of the Load Balancer.
29    #[serde(rename = "name")]
30    pub name: String,
31    /// ID of the network the Load Balancer should be attached to on creation.
32    #[serde(rename = "network", skip_serializing_if = "Option::is_none")]
33    pub network: Option<i64>,
34    /// Name of network zone.
35    #[serde(rename = "network_zone", skip_serializing_if = "Option::is_none")]
36    pub network_zone: Option<String>,
37    /// Enable or disable the public interface of the Load Balancer.
38    #[serde(rename = "public_interface", skip_serializing_if = "Option::is_none")]
39    pub public_interface: Option<bool>,
40    /// Array of services.
41    #[serde(rename = "services", skip_serializing_if = "Option::is_none")]
42    pub services: Option<Vec<models::LoadBalancerService>>,
43    /// Array of targets.
44    #[serde(rename = "targets", skip_serializing_if = "Option::is_none")]
45    pub targets: Option<Vec<models::LoadBalancerAddTarget>>,
46}
47
48impl CreateLoadBalancerRequest {
49    /// Request for POST https://api.hetzner.cloud/v1/load_balancers
50    pub fn new(load_balancer_type: String, name: String) -> CreateLoadBalancerRequest {
51        CreateLoadBalancerRequest {
52            algorithm: None,
53            labels: None,
54            load_balancer_type,
55            location: None,
56            name,
57            network: None,
58            network_zone: None,
59            public_interface: None,
60            services: None,
61            targets: None,
62        }
63    }
64}