Ejemplo n.º 1
0
def check():
    """Sanity check api deployment
    """
    t = time.time()
    results = Client(BASE_URL).version()
    print("Endpoint", BASE_URL)
    print("Response Time %0.2f" % (time.time() - t))
    print("Headers")
    for k, v in results.headers.items():
        print(" %s: %s" % (k, v))
    print("Body")
    print(results.text)
Ejemplo n.º 2
0
def list_locks(account_id, resource_type=None, resource_id=None):
    """Show extant locks and unlocks.
    """
    locks = Client(BASE_URL, account_id).list_locks().json()

    for r in locks:
        if 'LockDate' in r:
            r['LockDate'] = datetime.fromtimestamp(r['LockDate'])
        if 'RevisionDate' in r:
            r['RevisionDate'] = datetime.fromtimestamp(r['RevisionDate'])

    print(tabulate.tabulate(locks, headers="keys", tablefmt='fancy_grid'))
Ejemplo n.º 3
0
def delta(account_id, region):
    print(Client(BASE_URL).delta(account_id, region).text)
Ejemplo n.º 4
0
def unlock(resource_id, account_id):
    """Unlock a resource
    """
    return output(Client(BASE_URL, account_id).unlock(resource_id))
Ejemplo n.º 5
0
def lock(account_id, resource_id, region):
    """Lock a resource
    """
    return output(Client(BASE_URL, account_id).lock(resource_id, region))
Ejemplo n.º 6
0
def lock_status(account_id, resource_id, parent_id):
    """Show extant locks' status
    """
    return output(
        Client(BASE_URL, account_id).lock_status(resource_id, parent_id))