Skip to content

Getting a list of rules

Retrieves all rules for a specified Target with a single call. Returns the first n rules that can fit into a 4MB gRPC package.

Arguments:

  1. Execution context
  2. Method arguments, which includes:
  3. Target
  4. Additional headers (optional)

Result:

  • List of rules
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
func ListChains(ctx context.Context, p pool.Pool, cnrID cid.ID) []ape.Chain {
    prmListAPEChain := pool.PrmListAPEChains{
        Target: ape.ChainTarget{
            TargetType: ape.TargetTypeContainer,
            Name:       cnrID.EncodeToString(),
        },
    }

    chains, _ :=  p.ListAPEChains(ctx, prmListAPEChain)
    return chains
}
1
2
3
4
5
6
7
8
public static void listChains(FrostFSClient frostFSClient,
                           ContainerId containerId,
                           CallContext callContext) {
    var chainTarget = new ChainTarget(containerId.getValue(), TargetType.CONTAINER);
    var prmApeChainList = new PrmApeChainList(chainTarget);

    frostFSClient.listChains(prmApeChainList, callContext);
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
   protected static async Task<FrostFsChain[]> ListChains(
    IFrostFSClient client,
    FrostFsContainerId containerId)
{
    var listChainPrm = new PrmApeChainList(
       new FrostFsChainTarget(FrostFsTargetType.Container, containerId.GetValue())
   );

    return await client.ListChainAsync(listChainPrm, default);
}