Skip to content

Commit

Permalink
feat: add AllowedViewers to LogVisibility enum (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
maksymar committed Sep 6, 2024
1 parent 6e11a35 commit c19d1b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Breaking: Removed `Transport` and the `hyper` and `reqwest` features. `ReqwestTransport` is now the default and `HyperTransport` has been removed. Existing `ReqwestTransport` functions have been moved to `AgentBuilder`.
* `Url` now implements `RouteProvider`.
* Add canister snapshot methods to `ManagementCanister`.
* Add `AllowedViewers` to `LogVisibility` enum.

## [0.37.1] - 2024-07-25

Expand Down
5 changes: 4 additions & 1 deletion ic-utils/src/interfaces/management_canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub struct QueryStats {
}

/// Log visibility for a canister.
#[derive(Default, Clone, Copy, CandidType, Deserialize, Debug, PartialEq, Eq)]
#[derive(Default, Clone, CandidType, Deserialize, Debug, PartialEq, Eq)]
pub enum LogVisibility {
#[default]
#[serde(rename = "controllers")]
Expand All @@ -158,6 +158,9 @@ pub enum LogVisibility {
#[serde(rename = "public")]
/// Canister logs are visible to everyone.
Public,
#[serde(rename = "allowed_viewers")]
/// Canister logs are visible to a set of principals.
AllowedViewers(Vec<Principal>),
}

/// The concrete settings of a canister.
Expand Down
6 changes: 4 additions & 2 deletions ref-tests/tests/ic-ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,8 +1017,7 @@ mod extras {
ManagementCanister,
},
};
use ref_tests::get_effective_canister_id;
use ref_tests::with_agent;
use ref_tests::{get_effective_canister_id, with_agent};

#[ignore]
#[test]
Expand Down Expand Up @@ -1350,6 +1349,7 @@ mod extras {
with_agent(|agent| async move {
let ic00 = ManagementCanister::create(&agent);

// Create with Controllers.
let (canister_id,) = ic00
.create_canister()
.as_provisional_create_with_amount(Some(20_000_000_000_000_u128))
Expand All @@ -1361,6 +1361,7 @@ mod extras {
let result = ic00.canister_status(&canister_id).call_and_wait().await?;
assert_eq!(result.0.settings.log_visibility, LogVisibility::Controllers);

// Update to Public.
ic00.update_settings(&canister_id)
.with_log_visibility(LogVisibility::Public)
.call_and_wait()
Expand All @@ -1369,6 +1370,7 @@ mod extras {
let result = ic00.canister_status(&canister_id).call_and_wait().await?;
assert_eq!(result.0.settings.log_visibility, LogVisibility::Public);

// Update with no change.
let no_change: Option<LogVisibility> = None;
ic00.update_settings(&canister_id)
.with_optional_log_visibility(no_change)
Expand Down

0 comments on commit c19d1b6

Please sign in to comment.