Esempio n. 1
0
def get_customer(customer_name, keys_to_pluck=None):
    """Retrieve customer information.
    Args:
        customer_name (str):  Name of the customer.

    Kwargs:
        keys_to_pluck (list):  list of keys you want to retreive from the db.

    Basic Usage:
        >>> from vFense.customer.customers get_customer
        >>> customer_name = 'default'
        >>> get_customer(customer_name)

    Return:
        Dictionary of customer properties.
        {
            u'cpu_throttle': u'normal',
            u'package_download_url_base': u'http: //10.0.0.21/packages/',
            u'operation_ttl': 10,
            u'net_throttle': 0,
            u'customer_name': u'default'
        }
    """
    customer_data = {}
    if keys_to_pluck:
        customer_data = fetch_customer(customer_name, keys_to_pluck)
    else:
        customer_data = fetch_customer(customer_name)

    return (customer_data)
Esempio n. 2
0
def get_customer(customer_name, keys_to_pluck=None):
    """Retrieve customer information.
    Args:
        customer_name (str):  Name of the customer.

    Kwargs:
        keys_to_pluck (list):  list of keys you want to retreive from the db.

    Basic Usage:
        >>> from vFense.customer.customers get_customer
        >>> customer_name = 'default'
        >>> get_customer(customer_name)

    Return:
        Dictionary of customer properties.
        {
            u'cpu_throttle': u'normal',
            u'package_download_url_base': u'http: //10.0.0.21/packages/',
            u'operation_ttl': 10,
            u'net_throttle': 0,
            u'customer_name': u'default'
        }
    """
    customer_data = {}
    if keys_to_pluck:
        customer_data = fetch_customer(customer_name, keys_to_pluck)
    else:
        customer_data = fetch_customer(customer_name)

    return(customer_data)
Esempio n. 3
0
def get_customer_property(customer_name, customer_property):
    """Retrieve customer property.
    Args:
        customer_name (str):  Name of the customer.

    Kwargs:
        customer_property (str): Property you want to retrieve.

    Basic Usage:
        >>> from vFense.customer.customers get_customer_property
        >>> customer_name = 'default'
        >>> customer_property = 'operation_ttl'
        >>> get_customer(customer_name)

    Return:
        String
    """
    customer_data = fetch_customer(customer_name)
    customer_key = None
    if customer_data:
        customer_key = customer_data.get(customer_property)

    return (customer_key)
Esempio n. 4
0
def get_customer_property(customer_name, customer_property):
    """Retrieve customer property.
    Args:
        customer_name (str):  Name of the customer.

    Kwargs:
        customer_property (str): Property you want to retrieve.

    Basic Usage:
        >>> from vFense.customer.customers get_customer_property
        >>> customer_name = 'default'
        >>> customer_property = 'operation_ttl'
        >>> get_customer(customer_name)

    Return:
        String
    """
    customer_data = fetch_customer(customer_name)
    customer_key = None
    if customer_data:
        customer_key = customer_data.get(customer_property)

    return(customer_key)