Esempio n. 1
0
def rm(client, access_key):
    try:
        credentials = cred_lib.rm(client, access_key)
        utils.check(credentials)
        click.secho(f"Credentials removed", fg="green")
    except Exception as exc:
        click.secho(
            f"Credential removal failed. \n{exc}", fg="yellow", bold=True, err=True
        )
Esempio n. 2
0
    def delete(self):
        parser = reqparse.RequestParser()
        parser.add_argument("access_key", type=str, required=True)
        args = parser.parse_args()

        try:
            status = credential.rm(get_client(), args["access_key"])
            if "reason" in status:
                current_app.logger.error(status["reason"])
                return response(status["status_code"],
                                message=status["reason"])

            return response(
                200, f"Access key {args['access_key']} deleted successfully.")
        except Exception as e:
            current_app.logger.error(f"{e}")
            return response(500, f"{e}")
Esempio n. 3
0
def test_rm():
    assert cred.rm(fake_client(), "key") == "Done"