import random


def get_random_cluster_service_component(client, cluster, service) -> dict:
    """
    Get random cluster service component

    Args:
        client: ADCM client API objects
        cluster: some cluster object
        service: some service object in cluster

    Raises:
        :py:class:`ValueError`
            If service is not found
    """
    components = client.cluster.service.component.list(cluster_id=cluster['id'], service_id=service['id'])
    if components:
        return random.choice(components)
    raise ValueError('Service has not components')