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
//! Internal types used to wrap inputs and outputs. They should not be built
//! directly but are used by macros

use serde::{Deserialize, Serialize};

/// Simple Key-Value struct as needed by Concourse for metadata
#[allow(missing_debug_implementations)]
#[derive(Serialize)]
pub struct KV {
    /// The name of this metadata
    pub name: String,
    /// The value of this metadata
    pub value: String,
}

/// Output of the "in" step of the resource
#[allow(missing_debug_implementations)]
#[derive(Serialize)]
pub struct InOutputKV<V> {
    /// The fetched version.
    pub version: V,
    /// A list of key-value pairs. This data is intended for public consumption and will make
    /// it upstream, intended to be shown on the build's page.
    pub metadata: Option<Vec<KV>>,
}

/// Output of the "out" step of the resource
#[allow(missing_debug_implementations)]
#[derive(Serialize)]
pub struct OutOutputKV<V> {
    /// The resulting version.
    pub version: V,
    /// A list of key-value pairs. This data is intended for public consumption and will make
    /// it upstream, intended to be shown on the build's page.
    pub metadata: Option<Vec<KV>>,
}

/// Input of the "check" step of the resource
#[allow(missing_debug_implementations)]
#[derive(Deserialize)]
pub struct CheckInput<S, V> {
    /// Resource configuration, from the `source` field
    pub source: Option<S>,
    /// Latest version retrieved, or `None` on first check
    pub version: Option<V>,
}

/// Input of the "in" step of the resource
#[allow(missing_debug_implementations)]
#[derive(Deserialize)]
pub struct InInput<S, V, P> {
    /// Resource configuration, from the `source` field
    pub source: Option<S>,
    /// Version to retrieve
    pub version: V,
    /// Step configuration, from the `params` field
    pub params: Option<P>,
}

/// Input of the "out" step of the resource
#[allow(missing_debug_implementations)]
#[derive(Deserialize)]
pub struct OutInput<S, P> {
    /// Resource configuration, from the `source` field
    pub source: Option<S>,
    /// Step configuration, from the `params` field
    pub params: Option<P>,
}