How to use the screwdriver-data-schema.api function in screwdriver-data-schema

To help you get started, we’ve selected a few screwdriver-data-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github screwdriver-cd / screwdriver / plugins / status.js View on Github external
exports.register = (server, options, next) => {
    // Add the status route
    server.route({
        method: 'GET',
        path: '/status',
        handler: (request, reply) => reply('OK'),
        config: {
            description: 'API status',
            notes: 'Should respond with 200: ok',
            tags: ['api'],
            response: {
                schema: schema.api.status
            }
        }
    });
    next();
};
github screwdriver-cd / screwdriver / plugins / pipelines / metrics.js View on Github external
config.aggregateInterval = aggregateInterval;
                    }

                    return pipeline.getMetrics(config);
                })
                .then(metrics => reply(metrics))
                .catch(err => reply(boom.boomify(err)));
        },
        response: {
            schema: pipelineMetricListSchema
        },
        validate: {
            params: {
                id: pipelineIdSchema
            },
            query: schema.api.pagination.concat(joi.object({
                startTime: joi.string().isoDate(),
                endTime: joi.string().isoDate(),
                aggregateInterval: joi.string().valid('none', 'day', 'week', 'month', 'year')
            }))
        }
    }
});
github screwdriver-cd / screwdriver / plugins / builds / steps / logs.js View on Github external
return getMaxLines({ baseUrl, authToken })
                        .then(maxLines => loadLines({
                            baseUrl,
                            linesFrom,
                            authToken,
                            pagesToLoad,
                            sort,
                            maxLines
                        }))
                        .then(([lines, morePages]) => reply(lines)
                            .header('X-More-Data', (morePages || !isDone).toString()));
                })
                .catch(err => reply(boom.boomify(err)));
        },
        response: {
            schema: schema.api.loglines.output
        },
        validate: {
            params: schema.api.loglines.params,
            query: schema.api.loglines.query
        }
    }
});
github screwdriver-cd / screwdriver / plugins / builds / steps / logs.js View on Github external
authToken,
                            pagesToLoad,
                            sort,
                            maxLines
                        }))
                        .then(([lines, morePages]) => reply(lines)
                            .header('X-More-Data', (morePages || !isDone).toString()));
                })
                .catch(err => reply(boom.boomify(err)));
        },
        response: {
            schema: schema.api.loglines.output
        },
        validate: {
            params: schema.api.loglines.params,
            query: schema.api.loglines.query
        }
    }
});
github screwdriver-cd / screwdriver / plugins / templates / list.js View on Github external
return factory
                .list(config)
                .then((templates) => {
                    if (config.raw) {
                        return reply(templates);
                    }

                    return reply(templates.map(p => p.toJson()));
                })
                .catch(err => reply(boom.boomify(err)));
        },
        response: {
            schema: joi.alternatives().try(listSchema, namespacesSchema)
        },
        validate: {
            query: schema.api.pagination.concat(
                joi.object({
                    namespace: namespaceSchema,
                    distinct: distinctSchema,
                    compact: compactSchema
                })
            )
        }
    }
});
github screwdriver-cd / screwdriver / plugins / auth / token.js View on Github external
pipeline.scmContext,
                            ['build', 'impersonated']
                        );
                        profile.token = request.server.plugins.auth.generateToken(profile);

                        request.cookieAuth.set(profile);

                        return reply({ token: profile.token });
                    })
                    .catch(err => reply(boom.boomify(err)));
            }

            return reply({ token });
        },
        response: {
            schema: schema.api.auth.token
        }
    }
});
github screwdriver-cd / screwdriver / plugins / builds / steps / update.js View on Github external
step.lines = request.payload.lines;
                            } else {
                                step.startTime = request.payload.startTime || now;
                            }

                            return step.update();
                        });
                })
                .then(updatedStep => reply(updatedStep).code(200))
                .catch(err => reply(boom.boomify(err)));
        },
        response: {
            schema: schema.models.build.getStep
        },
        validate: {
            params: schema.api.loglines.params,
            payload: schema.models.build.updateStep
        }
    }
});
github screwdriver-cd / screwdriver / plugins / commands / listTags.js View on Github external
};
            }

            return factory.list(config)
                .then(tags => reply(tags.map(p => p.toJson())))
                .catch(err => reply(boom.boomify(err)));
        },
        response: {
            schema: listSchema
        },
        validate: {
            params: {
                namespace: namespaceSchema,
                name: nameSchema
            },
            query: schema.api.pagination
        }
    }
});
github screwdriver-cd / screwdriver / plugins / builds / token.js View on Github external
'use strict';

const boom = require('boom');
const joi = require('joi');
const schema = require('screwdriver-data-schema');
const authTokenSchema = schema.api.auth.token;
const buildIdSchema = joi.reach(schema.models.build.base, 'id');

module.exports = () => ({
    method: 'POST',
    path: '/builds/{id}/token',
    config: {
        description: 'Generate a JWT for use throughout a given build',
        notes: 'Generate a JWT for build using temporal JWT which passed in',
        tags: ['api', 'builds', 'build_token'],
        auth: {
            strategies: ['token'],
            scope: ['temporal']
        },
        plugins: {
            'hapi-swagger': {
                security: [{ token: [] }]
github screwdriver-cd / screwdriver / plugins / auth / key.js View on Github external
module.exports = options => ({
    method: ['GET'],
    path: '/auth/key',
    config: {
        description: 'Get jwt public key',
        notes: 'Public Key for verifying JSON Web Tokens',
        tags: ['api', 'auth', 'key'],
        handler: (request, reply) => reply({
            key: options.jwtPublicKey
        }),
        response: {
            schema: schema.api.auth.key
        }
    }
});

screwdriver-data-schema

Internal Data Schema of Screwdriver

BSD-3-Clause
Latest version published 21 days ago

Package Health Score

79 / 100
Full package analysis