Skip to main content

ListActions

ListActions will return a list of actions that have been performed on the node. The actions that will be persisted depends on the value of the --firewall.request-logger.level config option. The default value of the option is the "interceptor" mode which will persist only the actions (with all request parameters) made with macaroons with caveats that force them to be checked by an rpc middleware interceptor. If the "all" mode is used then all actions will be persisted but only full request parameters will only be stored if the actions are interceptor actions, otherwise only the URI and timestamp of the actions will be stored. The "full" mode will persist all request data for all actions.

Source: firewall.proto

gRPC

rpc ListActions (ListActionsRequest) returns (ListActionsResponse);

REST

HTTP MethodPath
POST /v1/firewall/actions

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:8443'
const MACAROON_PATH = 'LIT_DIR/regtest/lit.macaroon'
const TLS_PATH = 'LIT_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('firewall.proto', loaderOptions);
const litrpc = grpc.loadPackageDefinition(packageDefinition).litrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new litrpc.Firewall(GRPC_HOST, creds);
let request = {
feature_name: <string>,
actor_name: <string>,
method_name: <string>,
state: <ActionState>,
index_offset: <uint64>,
max_num_actions: <uint64>,
reversed: <bool>,
count_total: <bool>,
session_id: <bytes>,
start_timestamp: <uint64>,
end_timestamp: <uint64>,
group_id: <bytes>,
};
client.listActions(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "actions": <Action>,
// "last_index_offset": <uint64>,
// "total_count": <uint64>,
// }

Messages

litrpc.ListActionsRequest

Source: firewall.proto

FieldgRPC TypeREST TypeREST Placement
feature_name
stringstringbody
actor_name
stringstringbody
method_name
stringstringbody
state
ActionStatestringbody
index_offset
uint64stringbody
max_num_actions
uint64stringbody
reversed
boolbooleanbody
count_total
boolbooleanbody
session_id
bytesstringbody
start_timestamp
uint64stringbody
end_timestamp
uint64stringbody
group_id
bytesstringbody

litrpc.ListActionsResponse

Source: firewall.proto

FieldgRPC TypeREST Type
actions
Action[]array
last_index_offset
uint64string
total_count
uint64string

Nested Messages

litrpc.Action

FieldgRPC TypeREST Type
actor_name
stringstring
feature_name
stringstring
trigger
stringstring
intent
stringstring
structured_json_data
stringstring
rpc_method
stringstring
rpc_params_json
stringstring
timestamp
uint64string
state
ActionStatestring
error_reason
stringstring
session_id
bytesstring

Enums

litrpc.ActionState

NameNumber
STATE_UNKNOWN
0
STATE_PENDING
1
STATE_DONE
2
STATE_ERROR
3