Skip to content

Commit

Permalink
Update formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-richter committed Oct 11, 2024
1 parent 1feb285 commit e0c44b3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
8 changes: 7 additions & 1 deletion src/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,13 @@ pub async fn init_cli() {
{
if let PipelineVarsCommands::Set { input } = &pipeline_vars_command {
println!("🚀 Patching pipeline variables from input file {}\n", input);
set_pipeline_vars_from_file(input, &mut cm_client, cli.ci_mode, cli.dry_run_mode).await;
set_pipeline_vars_from_file(
input,
&mut cm_client,
cli.ci_mode,
cli.dry_run_mode,
)
.await;
process::exit(0);
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct PipelineVariable {
#[serde(rename(deserialize = "type", serialize = "type"))]
pub variable_type: VariableType,
#[serde(default = "PipelineVariableServiceType::default")]
pub service: PipelineVariableServiceType
pub service: PipelineVariableServiceType,
}

/// Model for all information about a Cloud Manager environment variable
Expand All @@ -62,8 +62,11 @@ pub struct EnvironmentVariable {
pub value: Option<String>,
#[serde(rename(deserialize = "type", serialize = "type"))]
pub variable_type: VariableType,
#[serde(default = "EnvironmentVariableServiceType::default", skip_serializing_if = "env_var_service_type_is_default")]
pub service: EnvironmentVariableServiceType
#[serde(
default = "EnvironmentVariableServiceType::default",
skip_serializing_if = "env_var_service_type_is_default"
)]
pub service: EnvironmentVariableServiceType,
}

/// Possible types that a variable can have
Expand Down
17 changes: 10 additions & 7 deletions src/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use crate::client::{AdobeConnector, CloudManagerClient};
use crate::encryption::decrypt;
use crate::environments::get_environment;
use crate::errors::throw_adobe_api_error;
use crate::models::{EnvironmentVariable, PipelineVariable, VariableType, EnvironmentVariablesList, EnvironmentVariablesResponse, YamlConfig, PipelineVariablesList, PipelineVariablesResponse};
use crate::models::{
EnvironmentVariable, EnvironmentVariablesList, EnvironmentVariablesResponse, PipelineVariable,
PipelineVariablesList, PipelineVariablesResponse, VariableType, YamlConfig,
};
use crate::pipelines::get_pipeline;
use crate::HOST_NAME;
use colored::*;
Expand Down Expand Up @@ -52,8 +55,8 @@ pub async fn get_env_vars(
.await?
.text()
.await?;
let variables: EnvironmentVariablesResponse =
serde_json::from_str(response.as_str()).unwrap_or_else(|_| {
let variables: EnvironmentVariablesResponse = serde_json::from_str(response.as_str())
.unwrap_or_else(|_| {
throw_adobe_api_error(response);
process::exit(1);
});
Expand Down Expand Up @@ -188,7 +191,7 @@ pub async fn set_env_vars_from_file(
name: vc.name,
value: None,
variable_type: vc.variable_type,
service: vc.service
service: vc.service,
};
vars_final.push(variable_to_be_deleted);
}
Expand Down Expand Up @@ -279,8 +282,8 @@ pub async fn get_pipeline_vars(
.await?
.text()
.await?;
let variables: PipelineVariablesResponse =
serde_json::from_str(response.as_str()).unwrap_or_else(|_| {
let variables: PipelineVariablesResponse = serde_json::from_str(response.as_str())
.unwrap_or_else(|_| {
throw_adobe_api_error(response);
process::exit(1);
});
Expand Down Expand Up @@ -418,7 +421,7 @@ pub async fn set_pipeline_vars_from_file(
name: vc.name,
value: None,
variable_type: vc.variable_type,
service: vc.service
service: vc.service,
};
vars_final.push(variable_to_be_deleted);
}
Expand Down

0 comments on commit e0c44b3

Please sign in to comment.