gitbundle_sdk/models/stage_context.rs
1/*
2 * GitBundle API
3 *
4 * GitBundle API documentation.
5 *
6 * The version of the OpenAPI document: 3.2.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12
13use crate::models;
14
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct StageContext {
17 /// Including all vars, priority from low to high, higher priority key could override lower priority key 1. The predefined variables for github/gitlab. 2. The web ui configured vars or envs, exclude secrets.
18 #[serde(rename = "all")]
19 pub all: std::collections::HashMap<String, String>,
20 /// Contains variables set in a workflow, job, or step. Static data eg: env.ENV_NAME Value is encoded with base64 standard
21 #[serde(rename = "env")]
22 pub env: std::collections::HashMap<String, String>,
23 #[serde(rename = "github", deserialize_with = "Option::deserialize")]
24 pub github: Option<serde_json::Value>,
25 /// Contains the inputs of a reusable or manually triggered workflow. Runtime data eg: ${{inputs.INPUT_NAME}} value is jobs.<job_id>.with 
26 #[serde(rename = "inputs")]
27 pub inputs: std::collections::HashMap<String, serde_json::Value>,
28 #[serde(rename = "job", deserialize_with = "Option::deserialize")]
29 pub job: Option<serde_json::Value>,
30 /// For reusable workflows only, contains outputs of jobs from the reusable workflow. Runtime data Initialized when stage is pushed into queue. Updated when stage is updated by api or else. key: job name or stage name value: JobsContext, refer to [Github docs](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#jobs-context). Converted to serde_json::Value for recursively inject variables
31 #[serde(rename = "jobs")]
32 pub jobs: std::collections::HashMap<String, serde_json::Value>,
33 #[serde(rename = "matrix")]
34 pub matrix: std::collections::HashMap<String, String>,
35 /// Contains the outputs of all jobs that are defined as a dependency of the current job. Runtime data key: job name value: JobsContext. Converted to serde_json::Value for recursively inject variables.
36 #[serde(rename = "needs")]
37 pub needs: std::collections::HashMap<String, serde_json::Value>,
38 #[serde(rename = "runner", deserialize_with = "Option::deserialize")]
39 pub runner: Option<serde_json::Value>,
40 /// Contains the names and values of secrets that are available to a workflow run. Sensitive data, only available to the job that will be running. eg: github: secrets.SECRET_NAME gitlab: $SECRET_NAME, secret.SECRET_NAME Value is encoded with base64 standard
41 #[serde(rename = "secrets")]
42 pub secrets: std::collections::HashMap<String, String>,
43 /// Information about the steps that have been run in the current job. Runtime data key: step id (set in step yaml) value: refer to StepsContext. Converted to serde_json::Value for recursively inject variables.
44 #[serde(rename = "steps")]
45 pub steps: std::collections::HashMap<String, serde_json::Value>,
46 #[serde(rename = "strategy", deserialize_with = "Option::deserialize")]
47 pub strategy: Option<serde_json::Value>,
48 /// Contains variables set at the repository, organization, or environment levels. Static data eg: gitlab: variables.VAR_NAME github: vars.VAR_NAME Value is encoded with base64 standard
49 #[serde(rename = "vars")]
50 pub vars: std::collections::HashMap<String, String>,
51}
52
53impl StageContext {
54 pub fn new(
55 all: std::collections::HashMap<String, String>,
56 env: std::collections::HashMap<String, String>,
57 github: Option<serde_json::Value>,
58 inputs: std::collections::HashMap<String, serde_json::Value>,
59 job: Option<serde_json::Value>,
60 jobs: std::collections::HashMap<String, serde_json::Value>,
61 matrix: std::collections::HashMap<String, String>,
62 needs: std::collections::HashMap<String, serde_json::Value>,
63 runner: Option<serde_json::Value>,
64 secrets: std::collections::HashMap<String, String>,
65 steps: std::collections::HashMap<String, serde_json::Value>,
66 strategy: Option<serde_json::Value>,
67 vars: std::collections::HashMap<String, String>,
68 ) -> StageContext {
69 StageContext {
70 all,
71 env,
72 github,
73 inputs,
74 job,
75 jobs,
76 matrix,
77 needs,
78 runner,
79 secrets,
80 steps,
81 strategy,
82 vars,
83 }
84 }
85}