Skip to content

Deleting a Container

Deletes a container by its ID.

Arguments:

  1. Execution context
  2. Method arguments, which includes:
    • Container ID
    • Result wait parameters (optional)
    • Session token (optional)
    • Additional headers (optional)

The internal implementation verifies that the container has been deleted by making periodic requests using the provided result wait parameters.

Result:

  • Success, if there are no errors
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
func DeleteContainer(p pool.Pool, cnrID cid.ID) {
    prmDelete := pool.PrmContainerDelete{
        ContainerID: cnrID,
    }

    ctx := context.Background()

    err := p.DeleteContainer(ctx, prmDelete)
    die(err)
}
1
2
3
4
5
public static void deleteContainer(FrostFSClient frostFSClient, ContainerId containerId, CallContext callContext) {
    PrmWait prmWait = new PrmWait(Duration.ofSeconds(120L), Duration.ofSeconds(5L));
    var prmContainerDelete = new PrmContainerDelete(containerId, prmWait);
    frostFSClient.deleteContainer(prmContainerDelete, callContext);
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
public static async Task DeleteContainerAsync(FrostFSClient client)
{
    PrmWait prmWait = new(timeout: 50, interval: 5);

    PrmContainerDelete deleteContainerParam = new(
        containerId: containerId,
        waitParams: prmWait,
        sessionToken: token,
        xheaders: []);

    await client.DeleteContainerAsync(deleteContainerParam, default);
}