async fn filter_by_idle_rules(
        &self,
        resource: &Resource,
        cw_client: Arc<Box<CwClient>>,
    ) -> bool {
        match resource.type_ {
            Client::Ec2Instance => cw_client.filter_instance(resource.id.as_str()).await,
            Client::EbsVolume => cw_client.filter_volume(resource.id.as_str()).await,
            Client::RdsInstance => cw_client.filter_db_instance(resource.id.as_str()).await,
            Client::RdsCluster => cw_client.filter_db_cluster(resource.id.as_str()).await,
            Client::RsCluster => cw_client.filter_rs_cluster(resource.id.as_str()).await,
            Client::EsDomain => cw_client.filter_es_domain(resource.id.as_str()).await,
            Client::ElbAlb => {
                let dimension_val = format!(
                    "app/{}/{}",
                    resource.id.as_str(),
                    resource.arn.as_deref().unwrap().split('/').last().unwrap()
                );
                cw_client
                    .filter_alb_load_balancer(dimension_val.as_str())
                    .await
            }
            Client::ElbNlb => {
                let dimension_val = format!(
                    "app/{}/{}",
                    resource.id.as_str(),
                    resource.arn.as_deref().unwrap().split('/').last().unwrap()
                );
                cw_client
                    .filter_nlb_load_balancer(dimension_val.as_str())
                    .await
            }
            Client::EcsCluster => cw_client.filter_ecs_cluster(resource.id.as_str()).await,
            Client::EmrCluster => cw_client.filter_emr_cluster(resource.id.as_str()).await,
            _ => false,
        }
    }
/// Filters a resource based on its idle rules (Cloudwatch metrics)
Filters a resource based on its idle rules (Cloudwatch metrics)
Filters a resource based on its idle rules ( Cloudwatch metrics )
async fn filter_by_idle_rules(
        &self,
        resource: &Resource,
        cw_client: Arc<Box<CwClient>>,
    ) -> bool {
        match resource.type_ {
            Client::Ec2Instance => cw_client.filter_instance(resource.id.as_str()).await,
            Client::EbsVolume => cw_client.filter_volume(resource.id.as_str()).await,
            Client::RdsInstance => cw_client.filter_db_instance(resource.id.as_str()).await,
            Client::RdsCluster => cw_client.filter_db_cluster(resource.id.as_str()).await,
            Client::RsCluster => cw_client.filter_rs_cluster(resource.id.as_str()).await,
            Client::EsDomain => cw_client.filter_es_domain(resource.id.as_str()).await,
            Client::ElbAlb => {
                let dimension_val = format!(
                    "app/{}/{}",
                    resource.id.as_str(),
                    resource.arn.as_deref().unwrap().split('/').last().unwrap()
                );
                cw_client
                    .filter_alb_load_balancer(dimension_val.as_str())
                    .await
            }
            Client::ElbNlb => {
                let dimension_val = format!(
                    "app/{}/{}",
                    resource.id.as_str(),
                    resource.arn.as_deref().unwrap().split('/').last().unwrap()
                );
                cw_client
                    .filter_nlb_load_balancer(dimension_val.as_str())
                    .await
            }
            Client::EcsCluster => cw_client.filter_ecs_cluster(resource.id.as_str()).await,
            Client::EmrCluster => cw_client.filter_emr_cluster(resource.id.as_str()).await,
            _ => false,
        }
    }
async fn filter_by_idle_rules ( & self , resource : & Resource , cw_client : Arc < Box < CwClient > > , ) -> bool { match resource . type_ { Client :: Ec2Instance => cw_client . filter_instance ( resource . id . as_str ( ) ) . await , Client :: EbsVolume => cw_client . filter_volume ( resource . id . as_str ( ) ) . await , Client :: RdsInstance => cw_client . filter_db_instance ( resource . id . as_str ( ) ) . await , Client :: RdsCluster => cw_client . filter_db_cluster ( resource . id . as_str ( ) ) . await , Client :: RsCluster => cw_client . filter_rs_cluster ( resource . id . as_str ( ) ) . await , Client :: EsDomain => cw_client . filter_es_domain ( resource . id . as_str ( ) ) . await , Client :: ElbAlb => { let dimension_val = format ! ( " " resource id as_str ( ) resource arn as_deref ( ) unwrap ( ) split ( '/' ) last ( ) unwrap ( ) ) ; cw_client . filter_alb_load_balancer ( dimension_val . as_str ( ) ) . await } Client :: ElbNlb => { let dimension_val = format ! ( " " resource id as_str ( ) resource arn as_deref ( ) unwrap ( ) split ( '/' ) last ( ) unwrap ( ) ) ; cw_client . filter_nlb_load_balancer ( dimension_val . as_str ( ) ) . await } Client :: EcsCluster => cw_client . filter_ecs_cluster ( resource . id . as_str ( ) ) . await , Client :: EmrCluster => cw_client . filter_emr_cluster ( resource . id . as_str ( ) ) . await , _ => false , } }
Filters a resource based on its idle rules (Cloudwatch metrics)
Filters a resource based on its idle rules ( Cloudwatch metrics )
&self
resource
&Resource
cw_client
Arc<Box<CwClient>>