API banners plugin for the Screwdriver API
const Hapi = require('@hapi/hapi');
const server = new Hapi.Server();
const bannersPlugin = require('./');
server.connection({ port: 3000 });
server.register({
register: bannersPlugin,
options: {}
}, () => {
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});
POST /banners
Arguments
message
- Text of the banner to create.type
- An optional banner type. Options areinfo
andwarn
. Defaults toinfo
isActive
- An optional status flag to indicate whether banner should display. Defaults tofalse
scope
- An optional scope type that specifies whether the banner should be displayed globally or limited to the affected pipelines or builds. Accepted values areGLOBAL
,PIPELINE
, andBUILD
, withGLOBAL
as the default.scopeId
- A required field when the scope is set toPIPELINE
orBUILD
, serving as a reference to the corresponding pipeline or build ID.
Example payload:
{
"message": "The Screwdriver Team is currently investigating random failures.",
"type": "info",
"isActive": "true",
"scope": "PIPELINE",
"scopeId": "12345"
}
Query Params:
scope
- Optional Returns banners for a specific scopescopeId
- Optional Filters by a specific scope IDcreatedBy
- Optional Filters banners created by a specific usertype
- Optional Filters by banner typeisActive
- Optional Accepts true or false to filter active or inactive banners
GET /banners
GET /banners?scope=GLOBAL&isActive=true&type=info
GET /banners?scope=PIPELINE&scopeId=12345&isActive=true&type=info
GET /banners/{id}
PUT /banners/{id}
Arguments
message
- An optional new string of text for the banner.type
- An optional new banner type. Options areinfo
andwarn
isActive
- An optional new status flag to indicate whether banner should display.
Example payload:
{
"message": "The Screwdriver Team has resolved the random failure issue.",
"type": "info",
"isActive": "true"
}
DELETE /banners/{id}