def update_aci(req): """ Update an ACI group """ err, msg = UCSUtil.check_aci_login(req) if err == 1: return jsonify({'error': msg}), 400 db = YamlDB() err, msg = db.update_aci(Const.KUBAM_CFG, req) if err == 1: return {'error': msg}, 400 return {'status': "ACI group {0} updated!".format(req["name"])}, 201
def create_aci(req): """ Create a new ACI entry Format of request should be JSON that looks like: {"name", "aci01", "credentials" : {"user":"******", "password": "******", "ip" : "172.28.225.163" }, ...} """ # Make sure we can log in first. msg, code = UCSUtil.check_aci_login(req) if code == 400: return msg, code db = YamlDB() err, msg = db.new_aci(Const.KUBAM_CFG, req) if err == 1: return {'error': msg}, 400 return { 'status': "new ACI group {0} created!".format(req["name"]) }, 201