pub struct ManagementCanister<'agent>(/* private fields */);Expand description
The IC management canister.
Implementations§
Source§impl<'agent> ManagementCanister<'agent>
impl<'agent> ManagementCanister<'agent>
Source§impl<'agent> ManagementCanister<'agent>
impl<'agent> ManagementCanister<'agent>
Sourcepub fn canister_status(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = (CanisterStatusResult,)>
pub fn canister_status( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = (CanisterStatusResult,)>
Get the status of a canister.
Sourcepub fn create_canister<'canister>(
&'canister self,
) -> CreateCanisterBuilder<'agent, 'canister>
pub fn create_canister<'canister>( &'canister self, ) -> CreateCanisterBuilder<'agent, 'canister>
Create a canister.
Sourcepub fn deposit_cycles(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn deposit_cycles( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = ()>
This method deposits the cycles included in this call into the specified canister. Only the controller of the canister can deposit cycles.
Sourcepub fn delete_canister(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn delete_canister( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = ()>
Deletes a canister.
Sourcepub fn provisional_top_up_canister(
&self,
canister_id: &Principal,
top_up_args: &ProvisionalTopUpCanisterArgs,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn provisional_top_up_canister( &self, canister_id: &Principal, top_up_args: &ProvisionalTopUpCanisterArgs, ) -> impl 'agent + AsyncCall<Value = ()>
Until developers can convert real ICP tokens to a top up an existing canister,
the system provides the provisional_top_up_canister method.
It adds amount cycles to the balance of canister identified by amount
(implicitly capping it at MAX_CANISTER_BALANCE).
Sourcepub fn raw_rand(&self) -> impl 'agent + AsyncCall<Value = (Vec<u8>,)>
pub fn raw_rand(&self) -> impl 'agent + AsyncCall<Value = (Vec<u8>,)>
This method takes no input and returns 32 pseudo-random bytes to the caller. The return value is unknown to any part of the IC at time of the submission of this call. A new return value is generated for each call to this method.
Sourcepub fn start_canister(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn start_canister( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = ()>
Starts a canister.
Sourcepub fn stop_canister(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn stop_canister( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = ()>
Stop a canister.
Sourcepub fn uninstall_code(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn uninstall_code( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = ()>
This method removes a canister’s code and state, making the canister empty again. Only the controller of the canister can uninstall code. Uninstalling a canister’s code will reject all calls that the canister has not yet responded to, and drop the canister’s code and state. Outstanding responses to the canister will not be processed, even if they arrive after code has been installed again. The canister is now empty. In particular, any incoming or queued calls will be rejected.
Sourcepub fn install_code<'canister>(
&'canister self,
canister_id: &Principal,
wasm: &'canister [u8],
) -> InstallCodeBuilder<'agent, 'canister>
pub fn install_code<'canister>( &'canister self, canister_id: &Principal, wasm: &'canister [u8], ) -> InstallCodeBuilder<'agent, 'canister>
Install a canister, with all the arguments necessary for creating the canister.
Sourcepub fn update_settings<'canister>(
&'canister self,
canister_id: &Principal,
) -> UpdateSettingsBuilder<'agent, 'canister>
pub fn update_settings<'canister>( &'canister self, canister_id: &Principal, ) -> UpdateSettingsBuilder<'agent, 'canister>
Update one or more of a canisters settings (i.e its controller, compute allocation, or memory allocation.)
Sourcepub fn upload_chunk(
&self,
canister_id: &Principal,
upload_chunk_args: &UploadChunkArgs,
) -> impl 'agent + AsyncCall<Value = (UploadChunkResult,)>
pub fn upload_chunk( &self, canister_id: &Principal, upload_chunk_args: &UploadChunkArgs, ) -> impl 'agent + AsyncCall<Value = (UploadChunkResult,)>
Upload a chunk of a WASM module to a canister’s chunked WASM storage.
Sourcepub fn clear_chunk_store(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn clear_chunk_store( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = ()>
Clear a canister’s chunked WASM storage.
Sourcepub fn stored_chunks(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = (StoredChunksResult,)>
pub fn stored_chunks( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = (StoredChunksResult,)>
Get a list of the hashes of a canister’s stored WASM chunks
Sourcepub fn install_chunked_code<'canister>(
&'canister self,
canister_id: &Principal,
wasm_module_hash: &[u8],
) -> InstallChunkedCodeBuilder<'agent, 'canister>
pub fn install_chunked_code<'canister>( &'canister self, canister_id: &Principal, wasm_module_hash: &[u8], ) -> InstallChunkedCodeBuilder<'agent, 'canister>
Install a canister module previously uploaded in chunks via upload_chunk.
Sourcepub fn install<'canister: 'builder, 'builder>(
&'canister self,
canister_id: &Principal,
wasm: &'builder [u8],
) -> InstallBuilder<'agent, 'canister, 'builder>
pub fn install<'canister: 'builder, 'builder>( &'canister self, canister_id: &Principal, wasm: &'builder [u8], ) -> InstallBuilder<'agent, 'canister, 'builder>
Install a canister module, automatically selecting one-shot installation or chunked installation depending on module size.
§Warnings
This will clear chunked code storage if chunked installation is used. Do not use with canisters that you are manually uploading chunked code to.
Sourcepub fn fetch_canister_logs(
&self,
args: &FetchCanisterLogsArgs,
) -> impl 'agent + SyncCall<Value = (FetchCanisterLogsResult,)>
pub fn fetch_canister_logs( &self, args: &FetchCanisterLogsArgs, ) -> impl 'agent + SyncCall<Value = (FetchCanisterLogsResult,)>
Fetch (query) the logs of a canister.
Sourcepub fn take_canister_snapshot(
&self,
take_args: &TakeCanisterSnapshotArgs,
) -> impl 'agent + AsyncCall<Value = (Snapshot,)>
pub fn take_canister_snapshot( &self, take_args: &TakeCanisterSnapshotArgs, ) -> impl 'agent + AsyncCall<Value = (Snapshot,)>
Creates a canister snapshot, optionally replacing an existing snapshot.
Sourcepub fn load_canister_snapshot(
&self,
load_args: &LoadCanisterSnapshotArgs,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn load_canister_snapshot( &self, load_args: &LoadCanisterSnapshotArgs, ) -> impl 'agent + AsyncCall<Value = ()>
Loads a canister snapshot by ID, replacing the canister’s state with its state at the time the snapshot was taken.
Sourcepub fn list_canister_snapshots(
&self,
canister_id: &Principal,
) -> impl 'agent + AsyncCall<Value = (Vec<Snapshot>,)>
pub fn list_canister_snapshots( &self, canister_id: &Principal, ) -> impl 'agent + AsyncCall<Value = (Vec<Snapshot>,)>
List a canister’s recorded snapshots.
Sourcepub fn delete_canister_snapshot(
&self,
delete_args: &DeleteCanisterSnapshotArgs,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn delete_canister_snapshot( &self, delete_args: &DeleteCanisterSnapshotArgs, ) -> impl 'agent + AsyncCall<Value = ()>
Deletes a recorded canister snapshot by ID.
Sourcepub fn read_canister_snapshot_metadata(
&self,
metadata_args: &ReadCanisterSnapshotMetadataArgs,
) -> impl 'agent + AsyncCall<Value = (ReadCanisterSnapshotMetadataResult,)>
pub fn read_canister_snapshot_metadata( &self, metadata_args: &ReadCanisterSnapshotMetadataArgs, ) -> impl 'agent + AsyncCall<Value = (ReadCanisterSnapshotMetadataResult,)>
Reads the metadata of a recorded canister snapshot by canister ID and snapshot ID.
Sourcepub fn read_canister_snapshot_data(
&self,
data_args: &ReadCanisterSnapshotDataArgs,
) -> impl 'agent + AsyncCall<Value = (ReadCanisterSnapshotDataResult,)>
pub fn read_canister_snapshot_data( &self, data_args: &ReadCanisterSnapshotDataArgs, ) -> impl 'agent + AsyncCall<Value = (ReadCanisterSnapshotDataResult,)>
Reads the data of a recorded canister snapshot by canister ID and snapshot ID.
Sourcepub fn upload_canister_snapshot_metadata(
&self,
metadata_args: &UploadCanisterSnapshotMetadataArgs,
) -> impl 'agent + AsyncCall<Value = (UploadCanisterSnapshotMetadataResult,)>
pub fn upload_canister_snapshot_metadata( &self, metadata_args: &UploadCanisterSnapshotMetadataArgs, ) -> impl 'agent + AsyncCall<Value = (UploadCanisterSnapshotMetadataResult,)>
Uploads the metadata of a canister snapshot by canister ID.
Sourcepub fn upload_canister_snapshot_data(
&self,
data_args: &UploadCanisterSnapshotDataArgs,
) -> impl 'agent + AsyncCall<Value = ()>
pub fn upload_canister_snapshot_data( &self, data_args: &UploadCanisterSnapshotDataArgs, ) -> impl 'agent + AsyncCall<Value = ()>
Uploads the data of a canister snapshot by canister ID and snapshot ID..
Sourcepub fn canister_metadata(
&self,
args: &CanisterMetadataArgs,
) -> impl 'agent + SyncCall<Value = (CanisterMetadataResult,)>
pub fn canister_metadata( &self, args: &CanisterMetadataArgs, ) -> impl 'agent + SyncCall<Value = (CanisterMetadataResult,)>
Fetch a named metadata section of a canister’s Wasm module.
Methods from Deref<Target = Canister<'agent>>§
Sourcepub fn canister_id_(&self) -> &Principal
pub fn canister_id_(&self) -> &Principal
Get the canister ID of this canister.
Prefer using canister_id instead.
Sourcepub fn canister_id(&self) -> &Principal
pub fn canister_id(&self) -> &Principal
Get the canister ID of this canister.
Sourcepub fn update_<'canister>(
&'canister self,
method_name: &str,
) -> AsyncCallBuilder<'agent, 'canister>
pub fn update_<'canister>( &'canister self, method_name: &str, ) -> AsyncCallBuilder<'agent, 'canister>
Create an AsyncCallBuilder to do an update call.
Prefer using update instead.
Sourcepub fn update<'canister>(
&'canister self,
method_name: &str,
) -> AsyncCallBuilder<'agent, 'canister>
pub fn update<'canister>( &'canister self, method_name: &str, ) -> AsyncCallBuilder<'agent, 'canister>
Create an AsyncCallBuilder to do an update call.
Sourcepub fn query_<'canister>(
&'canister self,
method_name: &str,
) -> SyncCallBuilder<'agent, 'canister>
pub fn query_<'canister>( &'canister self, method_name: &str, ) -> SyncCallBuilder<'agent, 'canister>
Create a SyncCallBuilder to do a query call.
Prefer using query instead.
Sourcepub fn query<'canister>(
&'canister self,
method_name: &str,
) -> SyncCallBuilder<'agent, 'canister>
pub fn query<'canister>( &'canister self, method_name: &str, ) -> SyncCallBuilder<'agent, 'canister>
Create a SyncCallBuilder to do a query call.
Sourcepub async fn wait<'canister>(
&'canister self,
request_id: &RequestId,
) -> Result<Vec<u8>, AgentError>
pub async fn wait<'canister>( &'canister self, request_id: &RequestId, ) -> Result<Vec<u8>, AgentError>
Call request_status on the RequestId in a loop and return the response as a byte vector.
Sourcepub fn clone_with_(&self, id: Principal) -> Self
pub fn clone_with_(&self, id: Principal) -> Self
Creates a copy of this canister, changing the canister ID to the provided principal.
Prefer using clone_with instead.
Sourcepub fn clone_with(&self, id: Principal) -> Self
pub fn clone_with(&self, id: Principal) -> Self
Creates a copy of this canister, changing the canister ID to the provided principal.
Trait Implementations§
Source§impl<'agent> Clone for ManagementCanister<'agent>
impl<'agent> Clone for ManagementCanister<'agent>
Source§fn clone(&self) -> ManagementCanister<'agent>
fn clone(&self) -> ManagementCanister<'agent>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more