General
The General handler aides Ranger with preparation of certain Deputy package types such as Event and allows Ranger to query the Deputy package repository. Currently the General handler supports two types of gRpc services, Event and DeputyQuery.
Services
Event
Event package types are used to display additional information to the participant in the Ranger environment in the form of a custom HTML page.
create
The Event create
gRPC endpoint is used to convert the Markdown pages to HTML and prepare them for Ranger to use. Redis is used to keep track of the created files and their metadata.
message Source {
string name = 1;
string version = 2;
}
Successful Response
message EventCreateResponse {
string id = 1;
string checksum = 2;
string filename = 3;
int64 size = 4;
}
stream
The previously prepared HTML pages are streamed to Ranger through the stream
gRPC endpoint.
Request
message Identifier {
string value = 1;
}
Successful Response
stream message EventStreamResponse {
bytes chunk = 1;
}
delete
Delete is used to remove a previously created HTML file from the General handler.
Request
message Identifier {
string value = 1;
}
Successful Response
message Empty {}
DeputyQuery
DeputyQuery currently has two gRPC endpoints, GetPackagesByType
and GetScenario
.
GetPackagesByType
GetPackagesByType is used to query the Deputy package repository for packages of a specific type.
Request
message GetPackagesQuery {
string package_type = 1;
}
Successful Response
message GetPackagesResponse {
repeated Package packages = 1;
}
For reference, the Package
message is defined as follows:
message Package {
string name = 1;
string version = 2;
string type = 3;
}
GetScenario
GetScenario is used to extract the SDL from a given Deputy package of type Exercise
.
Request
message Source {
string name = 1;
string version = 2;
}
Successful Response
message GetScenarioResponse {
string sdl = 1;
}
Configuration
The following configuration options are available for the General handler:
Variable | Mandatory | Type | Rules |
---|---|---|---|
redis_address | yes | string | Redis address |
redis_password | yes | string | Redis password |
server_address | yes | string | The handlers own address and port |
Example configuration file:
redis_address: redis-container:6379
redis_password: redis_password
server_address: 0.0.0.0:7777