async fn start_task(
        &self,
        task_definition: String,
        cluster_name: String,
        subnets: Vec<String>,
        security_group: String,
    ) -> Result<String> {
        let input = RunTaskRequest {
            task_definition,
            count: Some(1),
            cluster: Some(cluster_name),
            group: None,
            network_configuration: Some(NetworkConfiguration {
                awsvpc_configuration: Some(AwsVpcConfiguration {
                    assign_public_ip: Some("ENABLED".to_owned()),
                    subnets,
                    security_groups: Some(vec![security_group]),
                }),
            }),
            enable_ecs_managed_tags: None,
            capacity_provider_strategy: None,
            placement_constraints: None,
            placement_strategy: None,
            platform_version: None,
            launch_type: None,
            overrides: None,
            propagate_tags: None,
            reference_id: None,
            started_by: None,
            tags: None,
        };
        let result = timeout(Duration::from_secs(5), self.client.run_task(input))
            .await
            .map_err(|e| BuzzError::CloudClient(format!("{}", e)))?
            .map_err(|e| BuzzError::CloudClient(format!("{}", e)))?;
        if let Some(failures) = result.failures {
            if failures.len() > 0 {
                return Err(BuzzError::CloudClient(format!(
                    "An error occured with AWS Fargate task creation: {:?}",
                    failures
                )));
            }
        }

        Ok(result
            .tasks
            .unwrap()
            .into_iter()
            .next()
            .unwrap()
            .task_arn
            .unwrap())
    }
/// Start new task and return its arn
/// TODO better error management
Start new task and return its arn
TODO better error management
Start new task and return its arn TODO better error management
async fn start_task(
        &self,
        task_definition: String,
        cluster_name: String,
        subnets: Vec<String>,
        security_group: String,
    ) -> Result<String> {
        let input = RunTaskRequest {
            task_definition,
            count: Some(1),
            cluster: Some(cluster_name),
            group: None,
            network_configuration: Some(NetworkConfiguration {
                awsvpc_configuration: Some(AwsVpcConfiguration {
                    assign_public_ip: Some("ENABLED".to_owned()),
                    subnets,
                    security_groups: Some(vec![security_group]),
                }),
            }),
            enable_ecs_managed_tags: None,
            capacity_provider_strategy: None,
            placement_constraints: None,
            placement_strategy: None,
            platform_version: None,
            launch_type: None,
            overrides: None,
            propagate_tags: None,
            reference_id: None,
            started_by: None,
            tags: None,
        };
        let result = timeout(Duration::from_secs(5), self.client.run_task(input))
            .await
            .map_err(|e| BuzzError::CloudClient(format!("{}", e)))?
            .map_err(|e| BuzzError::CloudClient(format!("{}", e)))?;
        if let Some(failures) = result.failures {
            if failures.len() > 0 {
                return Err(BuzzError::CloudClient(format!(
                    "An error occured with AWS Fargate task creation: {:?}",
                    failures
                )));
            }
        }
        Ok(result
            .tasks
            .unwrap()
            .into_iter()
            .next()
            .unwrap()
            .task_arn
            .unwrap())
    }
async fn start_task ( & self , task_definition : String , cluster_name : String , subnets : Vec < String > , security_group : String , ) -> Result < String > { let input = RunTaskRequest { task_definition , count : Some ( 1 ) , cluster : Some ( cluster_name ) , group : None , network_configuration : Some ( NetworkConfiguration { awsvpc_configuration : Some ( AwsVpcConfiguration { assign_public_ip : Some ( " " . to_owned ( ) ) , subnets , security_groups : Some ( vec ! [ security_group ] ) , } ) , } ) , enable_ecs_managed_tags : None , capacity_provider_strategy : None , placement_constraints : None , placement_strategy : None , platform_version : None , launch_type : None , overrides : None , propagate_tags : None , reference_id : None , started_by : None , tags : None , } ; let result = timeout ( Duration :: from_secs ( 5 ) , self . client . run_task ( input ) ) . await . map_err ( | e | BuzzError :: CloudClient ( format ! ( " " e ) ) ) ? . map_err ( | e | BuzzError :: CloudClient ( format ! ( " " e ) ) ) ? ; if let Some ( failures ) = result . failures { if failures . len ( ) > 0 { return Err ( BuzzError :: CloudClient ( format ! ( " " failures ) ) ) ; } } Ok ( result . tasks . unwrap ( ) . into_iter ( ) . next ( ) . unwrap ( ) . task_arn . unwrap ( ) ) }
Start new task and return its arn
TODO better error management
Start new task and return its arn TODO better error management
&self
task_definition
String
cluster_name
String
subnets
Vec<String>
security_group
String
&self
task_definition
String
cluster_name
String
subnets
Vec<String>
security_group
String