tembo_api_client/models/
create_instance.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * Tembo Cloud
 *
 * Platform API for Tembo Cloud             </br>             </br>             To find a Tembo Data API, please find it here:             </br>             </br>             [AWS US East 1](https://api.data-1.use1.tembo.io/swagger-ui/)
 *
 * The version of the OpenAPI document: v1.0.0
 *
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateInstance {
    #[serde(
        rename = "app_services",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub app_services: Option<Option<Vec<models::AppType>>>,
    #[serde(
        rename = "autoscaling",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub autoscaling: Option<Option<Box<models::PatchAutoscaling>>>,
    #[serde(
        rename = "connection_pooler",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub connection_pooler: Option<Option<Box<models::ConnectionPooler>>>,
    #[serde(rename = "cpu")]
    pub cpu: models::Cpu,
    #[serde(
        rename = "dedicated_networking",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub dedicated_networking: Option<Option<Box<models::DedicatedNetworking>>>,
    #[serde(rename = "environment")]
    pub environment: models::Environment,
    #[serde(
        rename = "experimental",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub experimental: Option<Option<Box<models::Experimental>>>,
    #[serde(
        rename = "extensions",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub extensions: Option<Option<Vec<models::Extension>>>,
    #[serde(
        rename = "extra_domains_rw",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub extra_domains_rw: Option<Option<Vec<String>>>,
    #[serde(rename = "instance_name")]
    pub instance_name: String,
    #[serde(
        rename = "ip_allow_list",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub ip_allow_list: Option<Option<Vec<String>>>,
    #[serde(rename = "memory")]
    pub memory: models::Memory,
    #[serde(rename = "pg_version", skip_serializing_if = "Option::is_none")]
    pub pg_version: Option<i32>,
    #[serde(
        rename = "postgres_configs",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub postgres_configs: Option<Option<Vec<models::PgConfig>>>,
    #[serde(rename = "provider_id", skip_serializing_if = "Option::is_none")]
    pub provider_id: Option<String>,
    #[serde(rename = "region_id", skip_serializing_if = "Option::is_none")]
    pub region_id: Option<String>,
    #[serde(rename = "replicas", skip_serializing_if = "Option::is_none")]
    pub replicas: Option<i32>,
    #[serde(
        rename = "spot",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub spot: Option<Option<bool>>,
    #[serde(rename = "stack_type")]
    pub stack_type: models::StackType,
    #[serde(rename = "storage")]
    pub storage: models::Storage,
    #[serde(
        rename = "trunk_installs",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub trunk_installs: Option<Option<Vec<models::TrunkInstall>>>,
}

impl CreateInstance {
    pub fn new(
        cpu: models::Cpu,
        environment: models::Environment,
        instance_name: String,
        memory: models::Memory,
        stack_type: models::StackType,
        storage: models::Storage,
    ) -> CreateInstance {
        CreateInstance {
            app_services: None,
            autoscaling: None,
            connection_pooler: None,
            cpu,
            dedicated_networking: None,
            environment,
            experimental: None,
            extensions: None,
            extra_domains_rw: None,
            instance_name,
            ip_allow_list: None,
            memory,
            pg_version: None,
            postgres_configs: None,
            provider_id: None,
            region_id: None,
            replicas: None,
            spot: None,
            stack_type,
            storage,
            trunk_installs: None,
        }
    }
}