-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23761 from oleiman/vbotbuildovich/backport-23314-…
…v24.1.x-583 [v24.1.x] [CORE-7152] Admin: Introduce endpoint
- Loading branch information
Showing
11 changed files
with
499 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2024 Redpanda Data, Inc. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.md | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0 | ||
*/ | ||
|
||
#include "enterprise_features.h" | ||
|
||
#include "base/vassert.h" | ||
|
||
#include <iostream> | ||
|
||
namespace features { | ||
|
||
std::ostream& operator<<(std::ostream& os, license_required_feature f) { | ||
switch (f) { | ||
case license_required_feature::audit_logging: | ||
return os << "audit_logging"; | ||
case license_required_feature::cloud_storage: | ||
return os << "cloud_storage"; | ||
case license_required_feature::partition_auto_balancing_continuous: | ||
return os << "partition_auto_balancing_continuous"; | ||
case license_required_feature::gssapi: | ||
return os << "gssapi"; | ||
case license_required_feature::oidc: | ||
return os << "oidc"; | ||
case license_required_feature::schema_id_validation: | ||
return os << "schema_id_validation"; | ||
case license_required_feature::rbac: | ||
return os << "rbac"; | ||
} | ||
__builtin_unreachable(); | ||
} | ||
|
||
void enterprise_feature_report::set( | ||
license_required_feature feat, bool enabled) { | ||
auto insert = [feat](vtype& dest, const vtype& other) { | ||
vassert( | ||
!other.contains(feat), | ||
"feature {{{}}} cannot be both enabled and disabled", | ||
feat); | ||
dest.insert(feat); | ||
}; | ||
|
||
if (enabled) { | ||
insert(_enabled, _disabled); | ||
} else { | ||
insert(_disabled, _enabled); | ||
} | ||
} | ||
|
||
} // namespace features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2024 Redpanda Data, Inc. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file licenses/BSL.md | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <absl/container/flat_hash_set.h> | ||
#include <boost/range/iterator_range.hpp> | ||
|
||
#include <iosfwd> | ||
|
||
namespace features { | ||
|
||
enum class license_required_feature { | ||
audit_logging, | ||
cloud_storage, | ||
partition_auto_balancing_continuous, | ||
gssapi, | ||
oidc, | ||
schema_id_validation, | ||
rbac, | ||
}; | ||
|
||
std::ostream& operator<<(std::ostream&, license_required_feature); | ||
|
||
/** | ||
* Thin wrapper around two sets to indicate the current state of enterprise | ||
* features in the cluster. | ||
*/ | ||
class enterprise_feature_report { | ||
using vtype = absl::flat_hash_set<license_required_feature>; | ||
using range = boost::iterator_range<vtype::const_iterator>; | ||
|
||
public: | ||
void set(license_required_feature feat, bool enabled); | ||
range enabled() const { return _enabled; } | ||
range disabled() const { return _disabled; } | ||
bool any() const { return !_enabled.empty(); } | ||
|
||
private: | ||
vtype _enabled; | ||
vtype _disabled; | ||
}; | ||
|
||
} // namespace features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.