Skip to content

Commit

Permalink
Add is_provisioned flag to Token (#69)
Browse files Browse the repository at this point in the history
* add is_provisioned flag to Token

* update CHANGELOG
  • Loading branch information
atimin authored May 21, 2024
1 parent a446a80 commit d04a523
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- RS-261: Support for `each_n` and `each_s` query parameters, [PR-68](https://github.com/reductstore/reduct-cpp/pull/68)
- `is_provisioned` flag to Token, [PR-69](https://github.com/reductstore/reduct-cpp/pull/69)

### Fixed

Expand Down
1 change: 1 addition & 0 deletions src/reduct/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class Client : public IClient {
token_list.push_back(Token{
.name = token.at("name"),
.created_at = created_at,
.is_provisioned = token.at("is_provisioned"),
});
}
} catch (const std::exception& e) {
Expand Down
2 changes: 2 additions & 0 deletions src/reduct/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ class IClient {
struct Token {
std::string name; // name of token
Time created_at; // creation time
bool is_provisioned; // true if token is provisioned, you can't remove it or change its permissions


auto operator<=>(const IClient::Token&) const = default;
};
Expand Down
1 change: 1 addition & 0 deletions tests/reduct/token_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TEST_CASE("reduct::Client should get token list", "[token_api]") {
REQUIRE(tokens.size() == 1);
REQUIRE(tokens[0].name == "init-token");
REQUIRE(tokens[0].created_at.time_since_epoch().count() > 0);
REQUIRE_FALSE(tokens[0].is_provisioned);
}

TEST_CASE("reduct::Client should create token", "[token_api]") {
Expand Down

0 comments on commit d04a523

Please sign in to comment.