ThrowMsg(CynaraException::InvalidParam, msg);
case CYNARA_API_SERVICE_NOT_AVAILABLE:
ThrowMsg(CynaraException::ServiceNotAvailable, msg);
+ case CYNARA_API_BUCKET_NOT_FOUND:
+ ThrowMsg(CynaraException::BucketNotFound, msg);
default:
ThrowMsg(CynaraException::UnknownError, msg);
}
}
+void CynaraAdmin::EmptyBucket(const std::string &bucketName, bool recursive, const std::string &client,
+ const std::string &user, const std::string &privilege)
+{
+ checkCynaraError(
+ cynara_admin_erase(m_CynaraAdmin, bucketName.c_str(), static_cast<int>(recursive),
+ client.c_str(), user.c_str(), privilege.c_str()),
+ "Error while emptying bucket: " + bucketName + ", filter (C, U, P): " +
+ client + ", " + user + ", " + privilege);
+}
+
Cynara::Cynara()
{
checkCynaraError(
DECLARE_EXCEPTION_TYPE(Base, InvalidParam)
DECLARE_EXCEPTION_TYPE(Base, ServiceNotAvailable)
DECLARE_EXCEPTION_TYPE(Base, UnknownError)
+ DECLARE_EXCEPTION_TYPE(Base, BucketNotFound)
};
struct CynaraAdminPolicy : cynara_admin_policy
private:
CynaraAdmin();
+
+ /**
+ * Empty bucket using filter - matching rules will be removed
+ *
+ * @param bucketName name of the bucket to be emptied
+ * @param recursive flag to remove privileges recursively
+ * @param client client name
+ * @param user user name
+ * @param privilege privilege name
+ */
+ void EmptyBucket(const std::string &bucketName, bool recursive,
+ const std::string &client, const std::string &user, const std::string &privilege);
+
struct cynara_admin *m_CynaraAdmin;
};