tembo_api_client/models/
app_service.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
/*
 * 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};

/// AppService : AppService significantly extends the functionality of your Tembo Postgres instance by running tools and software built by the Postgres open source community.  **Example**: This will configure and install a Postgrest container along side the Postgres instance, install pg_graphql extension, and configure the ingress routing to expose the Postgrest service.  ```yaml apiVersion: coredb.io/v1alpha1 kind: CoreDB metadata: name: test-db spec: trunk_installs: - name: pg_graphql version: 1.2.0 extensions: - name: pg_graphql locations: - database: postgres enabled: true  appServices: - name: postgrest image: postgrest/postgrest:v10.0.0 routing: # only expose /rest/v1 and /graphql/v1 - port: 3000 ingressPath: /rest/v1 middlewares: - my-headers - port: 3000 ingressPath: /graphql/v1 middlewares: - map-gql - my-headers middlewares: - customRequestHeaders: name: my-headers config: # removes auth header from request Authorization: \"\" Content-Profile: graphql Accept-Profile: graphql - stripPrefix: name: my-strip-prefix config: - /rest/v1 # reroute gql and rest requests - replacePathRegex: name: map-gql config: regex: /graphql/v1/? replacement: /rpc/resolve env: - name: PGRST_DB_URI valueFromPlatform: ReadWriteConnection - name: PGRST_DB_SCHEMA value: \"public, graphql\" - name: PGRST_DB_ANON_ROLE value: postgres - name: PGRST_LOG_LEVEL value: info ```
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct AppService {
    /// Defines the arguments to pass into the container if needed. You define this in the same manner as you would for all Kubernetes containers. See the [Kubernetes docs](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container).
    #[serde(
        rename = "args",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub args: Option<Option<Vec<String>>>,
    /// Defines the command into the container if needed. You define this in the same manner as you would for all Kubernetes containers. See the [Kubernetes docs](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container).
    #[serde(
        rename = "command",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub command: Option<Option<Vec<String>>>,
    /// Defines the environment variables to pass into the container if needed. You define this in the same manner as you would for all Kubernetes containers. See the [Kubernetes docs](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container).
    #[serde(
        rename = "env",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub env: Option<Option<Vec<models::EnvVar>>>,
    /// Defines the container image to use for the appService.
    #[serde(rename = "image")]
    pub image: String,
    #[serde(
        rename = "metrics",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub metrics: Option<Option<Box<models::AppMetrics>>>,
    /// Defines the ingress middeware configuration for the appService. This is specifically configured for the ingress controller Traefik.
    #[serde(
        rename = "middlewares",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub middlewares: Option<Option<Vec<models::Middleware>>>,
    /// Defines the name of the appService.
    #[serde(rename = "name")]
    pub name: String,
    #[serde(
        rename = "probes",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub probes: Option<Option<Box<models::Probes>>>,
    #[serde(rename = "resources", skip_serializing_if = "Option::is_none")]
    pub resources: Option<Box<models::ResourceRequirements>>,
    /// Defines the routing configuration for the appService.
    #[serde(
        rename = "routing",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub routing: Option<Option<Vec<models::Routing>>>,
    #[serde(
        rename = "storage",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub storage: Option<Option<Box<models::StorageConfig>>>,
}

impl AppService {
    /// AppService significantly extends the functionality of your Tembo Postgres instance by running tools and software built by the Postgres open source community.  **Example**: This will configure and install a Postgrest container along side the Postgres instance, install pg_graphql extension, and configure the ingress routing to expose the Postgrest service.  ```yaml apiVersion: coredb.io/v1alpha1 kind: CoreDB metadata: name: test-db spec: trunk_installs: - name: pg_graphql version: 1.2.0 extensions: - name: pg_graphql locations: - database: postgres enabled: true  appServices: - name: postgrest image: postgrest/postgrest:v10.0.0 routing: # only expose /rest/v1 and /graphql/v1 - port: 3000 ingressPath: /rest/v1 middlewares: - my-headers - port: 3000 ingressPath: /graphql/v1 middlewares: - map-gql - my-headers middlewares: - customRequestHeaders: name: my-headers config: # removes auth header from request Authorization: \"\" Content-Profile: graphql Accept-Profile: graphql - stripPrefix: name: my-strip-prefix config: - /rest/v1 # reroute gql and rest requests - replacePathRegex: name: map-gql config: regex: /graphql/v1/? replacement: /rpc/resolve env: - name: PGRST_DB_URI valueFromPlatform: ReadWriteConnection - name: PGRST_DB_SCHEMA value: \"public, graphql\" - name: PGRST_DB_ANON_ROLE value: postgres - name: PGRST_LOG_LEVEL value: info ```
    pub fn new(image: String, name: String) -> AppService {
        AppService {
            args: None,
            command: None,
            env: None,
            image,
            metrics: None,
            middlewares: None,
            name,
            probes: None,
            resources: None,
            routing: None,
            storage: None,
        }
    }
}