Skip to content

Commit 828da22

Browse files
committed
feat: Flesh out change_set and make it public
The `change_set` module is now public, and features a more complete `ChangeSet` struct and a smorgasbord of supporting structs and enums. There are not yet any APIs for constructing these types. It's anticipated that there will be some mechanism for inspecting `ChangeSet`s prior to executing `ApplyStack` (and maybe even `DeleteStack`) operations.
1 parent b9d58fe commit 828da22

3 files changed

Lines changed: 561 additions & 37 deletions

File tree

src/apply_stack.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rusoto_core::RusotoError;
1212
use serde_plain::{forward_display_to_serde, forward_from_str_to_serde};
1313

1414
use crate::{
15-
change_set::{create_change_set, execute_change_set, ChangeSet, CreateChangeSetError},
15+
change_set::{create_change_set, execute_change_set, ChangeSetWithType, CreateChangeSetError},
1616
stack::StackOperationError,
1717
ChangeSetStatus, StackEvent, StackFailure, StackStatus, StackWarning,
1818
};
@@ -601,13 +601,13 @@ impl<'client> ApplyStack<'client> {
601601
let event_stream = try_stream! {
602602
let change_set = match create_change_set_internal(client, input).await? {
603603
Ok(change_set) => change_set,
604-
Err(change_set) => {
604+
Err(ChangeSetWithType { change_set, .. }) => {
605605
let output = describe_output(client, change_set.stack_id).await?;
606606
yield ApplyStackEvent::Output(output);
607607
return;
608608
}
609609
};
610-
let stack_id = change_set.stack_id.clone();
610+
let stack_id = change_set.change_set.stack_id.clone();
611611

612612
let mut operation = execute_change_set(client, change_set)
613613
.await
@@ -716,7 +716,7 @@ enum ApplyStackEvent {
716716
async fn create_change_set_internal<Client: CloudFormation>(
717717
client: &Client,
718718
input: ApplyStackInput,
719-
) -> Result<Result<ChangeSet, ChangeSet>, ApplyStackError> {
719+
) -> Result<Result<ChangeSetWithType, ChangeSetWithType>, ApplyStackError> {
720720
let error = match create_change_set(client, input.into_raw()).await {
721721
Ok(change_set) => return Ok(Ok(change_set)),
722722
Err(error) => error,
@@ -725,13 +725,15 @@ async fn create_change_set_internal<Client: CloudFormation>(
725725
CreateChangeSetError::NoChanges(change_set) => Ok(Err(change_set)),
726726
CreateChangeSetError::CreateApi(error) => Err(ApplyStackError::from_rusoto_error(error)),
727727
CreateChangeSetError::PollApi(error) => Err(ApplyStackError::from_rusoto_error(error)),
728-
CreateChangeSetError::Failed(change_set) => Err(ApplyStackError::CreateChangeSetFailed {
729-
id: change_set.id,
730-
status: change_set.status,
731-
status_reason: change_set
732-
.status_reason
733-
.expect("ChangeSet failed without reason"),
734-
}),
728+
CreateChangeSetError::Failed(ChangeSetWithType { change_set, .. }) => {
729+
Err(ApplyStackError::CreateChangeSetFailed {
730+
id: change_set.change_set_id,
731+
status: change_set.status,
732+
status_reason: change_set
733+
.status_reason
734+
.expect("ChangeSet failed without reason"),
735+
})
736+
}
735737
}
736738
}
737739

0 commit comments

Comments
 (0)