コード例 #1
0
ファイル: sshkey.py プロジェクト: JD-Multimedia/gandi.cli
def list(gandi, id, limit):
    """ List SSH keys. """
    options = {"items_per_page": limit}

    output_keys = ["name", "fingerprint"]

    if id:
        output_keys.append("id")

    result = gandi.sshkey.list(options)
    for sshkey in result:
        gandi.separator_line()
        output_sshkey(gandi, sshkey, output_keys)

    return result
コード例 #2
0
ファイル: sshkey.py プロジェクト: JD-Labs/gandi.cli
def list(gandi, id, limit):
    """ List SSH keys. """
    options = {
        'items_per_page': limit,
    }

    output_keys = ['name', 'fingerprint']

    if id:
        output_keys.append('id')

    result = gandi.sshkey.list(options)
    for sshkey in result:
        gandi.separator_line()
        output_sshkey(gandi, sshkey, output_keys)

    return result
コード例 #3
0
ファイル: sshkey.py プロジェクト: andronux/gandi.cli
def list(gandi, id, limit):
    """ List SSH keys. """
    options = {
        'items_per_page': limit,
    }

    output_keys = ['name', 'fingerprint']

    if id:
        output_keys.append('id')

    result = gandi.sshkey.list(options)
    for sshkey in result:
        gandi.separator_line()
        output_sshkey(gandi, sshkey, output_keys)

    return result
コード例 #4
0
def create(gandi, name, value=None, filename=None):
    """ Create a new SSH key. """
    if not value and not filename:
        raise UsageError('You must set value OR filename.')

    if value and filename:
        raise UsageError('You must not set value AND filename.')

    if filename:
        value = filename.read()

    ret = gandi.sshkey.create(name, value)

    output_keys = ['id', 'name', 'fingerprint']
    return output_sshkey(gandi, ret, output_keys)
コード例 #5
0
ファイル: sshkey.py プロジェクト: JD-Labs/gandi.cli
def create(gandi, name, value=None, sshkey=None):
    """ Create a new SSH key. """
    if not value and not sshkey:
        raise UsageError('You must set value OR sshkey.')

    if value and sshkey:
        raise UsageError('You must not set value AND sshkey.')

    if sshkey:
        value = sshkey.read()

    ret = gandi.sshkey.create(name, value)
    if not ret:
        return

    output_keys = ['id', 'name', 'fingerprint']
    return output_sshkey(gandi, ret, output_keys)
コード例 #6
0
ファイル: sshkey.py プロジェクト: JD-Multimedia/gandi.cli
def create(gandi, name, value=None, sshkey=None):
    """ Create a new SSH key. """
    if not value and not sshkey:
        raise UsageError("You must set value OR sshkey.")

    if value and sshkey:
        raise UsageError("You must not set value AND sshkey.")

    if sshkey:
        value = sshkey.read()

    ret = gandi.sshkey.create(name, value)
    if not ret:
        return

    output_keys = ["id", "name", "fingerprint"]
    return output_sshkey(gandi, ret, output_keys)
コード例 #7
0
def info(gandi, resource, id, value):
    """Display information about an SSH key.

    Resource can be a name or an ID
    """
    output_keys = ['name', 'fingerprint']
    if id:
        output_keys.append('id')

    if value:
        output_keys.append('value')

    ret = []
    for item in resource:
        sshkey = gandi.sshkey.info(item)
        ret.append(output_sshkey(gandi, sshkey, output_keys))

    return ret