Ejemplo n.º 1
0
def validate_service(cluster: str, service: str,
                     client: boto3.client) -> Union[str, None]:
    """Validates the provided service exists in the cluster"""
    service = client.describe_services(cluster=cluster,
                                       services=[service])['services']
    if not service:
        return
    return service[0]['serviceArn']
def validate(client: boto3.client, cluster: str = None, service: str = None):
    """Validate that a service and/or cluster exists"""
    if cluster:
        response = client.describe_clusters(clusters=[cluster])["clusters"]
        if not response:
            raise FailedActivity("unable to locate cluster: %s" % cluster)

    if service:
        response = client.describe_services(cluster=cluster, services=[service])[
            "services"
        ]
        if not response:
            raise FailedActivity(
                f"unable to locate service: {service} on cluster: {cluster}"
            )
Ejemplo n.º 3
0
def validate(client: boto3.client,
             cluster: str = None,
             service: str = None):
    """Validate that a service and/or cluster exists"""
    if cluster:
        response = client.describe_clusters(clusters=[cluster])['clusters']
        if not response:
            raise FailedActivity('unable to locate cluster: %s' % cluster)

    if service:
        response = client.describe_services(
            cluster=cluster, services=[service])['services']
        if not response:
            raise FailedActivity(
                'unable to locate service: %s on cluster: %s' % (
                    service, cluster))