def get_api_status():
    returned_api_status = None

    status_api_response = cbc_api_get('/v2/status')

    if status_api_response is not None:
        # API got called , check if we got something back
        if status_api_response['responseStatus'] is not None:
            returned_api_status = status_api_response['responseHTTPInfo'][
                'httpMessage']

    return returned_api_status
Beispiel #2
0
def get_clusters_from_api():

    cluster_api_response = cbc_api_get('/v2/clusters')

    cluster_list = []

    if cluster_api_response['responseStatus'] is not None:
        list_of_clusters = cluster_api_response['responseContent']

        # Did we get a list?
        if list_of_clusters is not None:
            for cluster in list_of_clusters['data']:
                # Builds up a row to display in a table
                # Table is generated by _pretty_table
                # by whomever called this function
                cluster_list.append([cluster['name'], cluster['id'], cluster['nodes'], cluster['services']])

    return(cluster_list)
def get_projects_from_api():

    projects_api_response = cbc_api_get('/v2/projects')

    project_list = []

    if projects_api_response['responseStatus'] is not None:
        list_of_projects = projects_api_response['responseContent']

        # Did we get a list?
        if list_of_projects is not None:
            for project in list_of_projects['data']:
                # Builds up a row to display in a table
                # Table is generated by _pretty_table
                # by whomever called this function
                project_list.append([
                    project['name'],
                    maya.parse(project['createdAt']), project['id']
                ])

    return (project_list)
Beispiel #4
0
def get_cluster_from_api(cluster_id):
    cluster_api_response = cbc_api_get('/v2/clusters/' + cluster_id)

    return (cluster_api_response)