class AwsEksCluster
def fetch_from_api # rubocop:disable Metrics/AbcSize
def fetch_from_api # rubocop:disable Metrics/AbcSize backend = BackendFactory.create(inspec_runner) begin params = { name: cluster_name } resp = backend.describe_cluster(params) rescue Aws::EKS::Errors::ResourceNotFoundException @exists = false populate_as_missing return end @exists = true cluster = resp.to_h[:cluster] @version = cluster[:version] @name = cluster[:name] @arn = cluster[:arn] @certificate_authority = cluster[:certificate_authority][:data] @created_at = cluster[:created_at] @endpoint = cluster[:endpoint] @security_group_ids = cluster[:resources_vpc_config][:security_group_ids] @subnet_ids = cluster[:resources_vpc_config][:subnet_ids] @subnets_count = cluster[:resources_vpc_config][:subnet_ids].length @security_groups_count = cluster[:resources_vpc_config][:security_group_ids].length @vpc_id = cluster[:resources_vpc_config][:vpc_id] @role_arn = cluster[:role_arn] @status = cluster[:status] @active = cluster[:status] == "ACTIVE" @failed = cluster[:status] == "FAILED" @creating = cluster[:status] == "CREATING" @deleting = cluster[:status] == "DELETING" end