Line data Source code
1 : //! Structs representing the JSON formats used in the compute_ctl's HTTP API.
2 : use serde::{Deserialize, Serialize};
3 :
4 : use crate::privilege::Privilege;
5 : use crate::responses::ComputeCtlConfig;
6 : use crate::spec::{ComputeSpec, ExtVersion, PgIdent};
7 :
8 : /// When making requests to the `compute_ctl` external HTTP server, the client
9 : /// must specify a set of claims in `Authorization` header JWTs such that
10 : /// `compute_ctl` can authorize the request.
11 0 : #[derive(Clone, Debug, Deserialize, Serialize)]
12 : pub struct ComputeClaims {
13 : pub compute_id: String,
14 : }
15 :
16 : /// Request of the /configure API
17 : ///
18 : /// We now pass only `spec` in the configuration request, but later we can
19 : /// extend it and something like `restart: bool` or something else. So put
20 : /// `spec` into a struct initially to be more flexible in the future.
21 0 : #[derive(Debug, Deserialize, Serialize)]
22 : pub struct ConfigurationRequest {
23 : pub spec: ComputeSpec,
24 : pub compute_ctl_config: ComputeCtlConfig,
25 : }
26 :
27 0 : #[derive(Deserialize, Debug)]
28 : pub struct ExtensionInstallRequest {
29 : pub extension: PgIdent,
30 : pub database: PgIdent,
31 : pub version: ExtVersion,
32 : }
33 :
34 0 : #[derive(Deserialize, Debug)]
35 : pub struct SetRoleGrantsRequest {
36 : pub database: PgIdent,
37 : pub schema: PgIdent,
38 : pub privileges: Vec<Privilege>,
39 : pub role: PgIdent,
40 : }
|