(
name: &str,
alias: &str,
version: &str,
client: &LambdaClient,
)
| 598 | } |
| 599 | |
| 600 | pub(crate) async fn upsert_alias( |
| 601 | name: &str, |
| 602 | alias: &str, |
| 603 | version: &str, |
| 604 | client: &LambdaClient, |
| 605 | ) -> Result<()> { |
| 606 | let current_alias = client |
| 607 | .get_alias() |
| 608 | .name(alias) |
| 609 | .function_name(name) |
| 610 | .send() |
| 611 | .await; |
| 612 | |
| 613 | match current_alias { |
| 614 | Ok(_) => { |
| 615 | client |
| 616 | .update_alias() |
| 617 | .name(alias) |
| 618 | .function_name(name) |
| 619 | .function_version(version) |
| 620 | .send() |
| 621 | .await |
| 622 | .into_diagnostic() |
| 623 | .wrap_err("failed to update alias")?; |
| 624 | } |
| 625 | Err(no_fun) if alias_doesnt_exist_error(&no_fun) => { |
| 626 | client |
| 627 | .create_alias() |
| 628 | .name(alias) |
| 629 | .function_name(name) |
| 630 | .function_version(version) |
| 631 | .send() |
| 632 | .await |
| 633 | .into_diagnostic() |
| 634 | .wrap_err("failed to create alias")?; |
| 635 | } |
| 636 | Err(no_fun) => { |
| 637 | return Err(no_fun) |
| 638 | .into_diagnostic() |
| 639 | .wrap_err("failed to fetch alias"); |
| 640 | } |
| 641 | }; |
| 642 | |
| 643 | Ok(()) |
| 644 | } |
| 645 | |
| 646 | pub(crate) async fn upsert_function_url_config( |
| 647 | name: &str, |
no test coverage detected