From 8d2e9af7471c31f4508791132091e0a3fa197193 Mon Sep 17 00:00:00 2001 From: Eric Ghildyal Date: Tue, 26 Nov 2024 17:33:23 -0500 Subject: [PATCH] Switch to using function calls for aws RestApi objects --- src/adapters/ingresses/apig.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/adapters/ingresses/apig.rs b/src/adapters/ingresses/apig.rs index e59db8b..52fd24c 100644 --- a/src/adapters/ingresses/apig.rs +++ b/src/adapters/ingresses/apig.rs @@ -65,7 +65,7 @@ impl AwsApiGateway { let api = all_apis .items() .iter() - .find(|api| api.name.clone().unwrap() == api_name) + .find(|api| api.name().unwrap() == api_name) .ok_or(miette!( "Could not find an API Gateway with the name: {}", api_name @@ -117,13 +117,13 @@ impl Ingress for AwsApiGateway { .ok_or(miette!("Couldn't get version of deployed lambda"))?; let api = self.get_api_id_by_name(&self.gateway_name).await?; - let api_id = api.id.ok_or(miette!("Couldn't get ID of deployed API"))?; + let api_id = api.id().ok_or(miette!("Couldn't get ID of deployed API"))?; // Next, we need to create a new deployment, pointing at our // new lambda version with canary settings self.apig_client .put_integration() - .rest_api_id(&api_id) + .rest_api_id(api_id) .uri(format!("{}:{}", lambda_arn, version)) .send() .await @@ -132,7 +132,7 @@ impl Ingress for AwsApiGateway { // Create a deployment with canary settings to deploy our new lambda self.apig_client .create_deployment() - .rest_api_id(&api_id) + .rest_api_id(api_id) .stage_name(&self.stage_name) .canary_settings( DeploymentCanarySettings::builder() @@ -150,7 +150,7 @@ impl Ingress for AwsApiGateway { async fn set_canary_traffic(&mut self, percent: WholePercent) -> Result<()> { let api = self.get_api_id_by_name(&self.gateway_name).await?; - let api_id = api.id.ok_or(miette!("Couldn't get ID of deployed API"))?; + let api_id = api.id().ok_or(miette!("Couldn't get ID of deployed API"))?; let patch_op = PatchOperation::builder() .op(Op::Replace) @@ -172,7 +172,7 @@ impl Ingress for AwsApiGateway { async fn rollback_canary(&mut self) -> Result<()> { let api = self.get_api_id_by_name(&self.gateway_name).await?; - let api_id = api.id.ok_or(miette!("Couldn't get ID of deployed API"))?; + let api_id = api.id().ok_or(miette!("Couldn't get ID of deployed API"))?; // Updates the stage to delete any canary settings from the API Gateway let patch_op = PatchOperation::builder() @@ -194,7 +194,7 @@ impl Ingress for AwsApiGateway { async fn promote_canary(&mut self) -> Result<()> { let api = self.get_api_id_by_name(&self.gateway_name).await?; - let api_id = api.id.ok_or(miette!("Couldn't get ID of deployed API"))?; + let api_id = api.id().ok_or(miette!("Couldn't get ID of deployed API"))?; // Overwrite the main deployment's ID with the canary's let replace_deployment_op = PatchOperation::builder()