1.1.1 • Published 4 years ago

@hyperone/resource-provider v1.1.1

Weekly downloads
141
License
-
Repository
github
Last release
4 years ago

Resource Provider Framework

Versions

  • 1.1.1 - Fix compatibility check in bulkEmitMetric
  • 1.1.0 - Updated protocol & signature in bulkEmitMetric in region.js to write multiple points of resource per request
  • 1.0.0 - Added support for bulkEmitMetric in region.js
  • 1.0.0 - Added support for emit metric to metric_uri via passport file
  • 1.0.0 - Added AuthPasswordOrToken to authenticate & authorize request via IAM / password

OpenAPI

const {openapi} = require('apf');
const Koa = require('koa');
const Router = require('koa-router');
const app = new Koa();
const router = new Router();

const swagger = openapi({
    router: router,
    info: require('./package.json'),
});

swagger.api.addSchema('containerCreate', openapi.props({
    id: {type: 'string'},
    state: {
        type: 'string',
        enum: ['Online', 'Attached', 'Detached', 'Unknown'],
        'x-rbx-field-type': ['state', 'live'],
    },
}));

swagger.addEndpoint({
    method: 'get',
    url: '/resource/:id',
    handler: async (ctx) => {
        ctx.body = await ctx.backend.containerShow(ctx.params.id);
    },
    responses: {
        200: {
            description: 'resource state',
            content: {
                'application/json': {
                    schema: openapi.refComp('container'),
                },
            },
        },
    },
});

router.stack
    .map(route => route.methods.map(method => `AGENT ${method} ${route.path}`)
    .forEach(v => console.log(v)));

app
    .use(router.routes())
    .use(router.allowedMethods());
1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago