concourse_resource/
internal.rs

1//! Internal types used to wrap inputs and outputs. They should not be built
2//! directly but are used by macros
3
4use serde::{Deserialize, Serialize};
5
6/// Simple Key-Value struct as needed by Concourse for metadata
7#[allow(missing_debug_implementations)]
8#[derive(Serialize)]
9pub struct KV {
10    /// The name of this metadata
11    pub name: String,
12    /// The value of this metadata
13    pub value: String,
14}
15
16/// Output of the "in" step of the resource
17#[allow(missing_debug_implementations)]
18#[derive(Serialize)]
19pub struct InOutputKV<V> {
20    /// The fetched version.
21    pub version: V,
22    /// A list of key-value pairs. This data is intended for public consumption and will make
23    /// it upstream, intended to be shown on the build's page.
24    pub metadata: Option<Vec<KV>>,
25}
26
27/// Output of the "out" step of the resource
28#[allow(missing_debug_implementations)]
29#[derive(Serialize)]
30pub struct OutOutputKV<V> {
31    /// The resulting version.
32    pub version: V,
33    /// A list of key-value pairs. This data is intended for public consumption and will make
34    /// it upstream, intended to be shown on the build's page.
35    pub metadata: Option<Vec<KV>>,
36}
37
38/// Input of the "check" step of the resource
39#[allow(missing_debug_implementations)]
40#[derive(Deserialize)]
41pub struct CheckInput<S, V> {
42    /// Resource configuration, from the `source` field
43    pub source: Option<S>,
44    /// Latest version retrieved, or `None` on first check
45    pub version: Option<V>,
46}
47
48/// Input of the "in" step of the resource
49#[allow(missing_debug_implementations)]
50#[derive(Deserialize)]
51pub struct InInput<S, V, P> {
52    /// Resource configuration, from the `source` field
53    pub source: Option<S>,
54    /// Version to retrieve
55    pub version: V,
56    /// Step configuration, from the `params` field
57    pub params: Option<P>,
58}
59
60/// Input of the "out" step of the resource
61#[allow(missing_debug_implementations)]
62#[derive(Deserialize)]
63pub struct OutInput<S, P> {
64    /// Resource configuration, from the `source` field
65    pub source: Option<S>,
66    /// Step configuration, from the `params` field
67    pub params: Option<P>,
68}