pomerium / enterprise-client Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Getting GRPC UNKNOWN / "sql: no rows in result set" but should be getting GRPC NOT_FOUND. I think I'll have a few more as I wrap up building out this Terraform provider (GRPC equivalent of returning HTTP/500 instead of HTTP/404)
Replication: read route request on a missing / deleted id. Get error with code of, expect code of 5. https://grpc.github.io/grpc/core/md_doc_statuscodes.html
I did not find an enterprise nodejs client available; is it possible to have a client created similar to the python and go clients?
I have been trying to use @grpc/grpc-js
and @grpc/proto-loader
to create it and this is what I have come up with so far (against the update-docs-template
branch):
pull.sh:
#!/bin/bash
# Directory to ignore
LIB_DIR="lib"
# Git repositories to clone
REPO1="envoyproxy/data-plane-api"
TAG1="3a71d52b66bc661c25ba6f6b082d900b09ea7fd8"
REPO2="googleapis/googleapis"
TAG2="9a7d19079b5e3c22a5a08eaa94273f5d1eebb317"
REPO3="bufbuild/protoc-gen-validate"
TAG3="59da36e59fef2267fc2b1849a05159e3ecdf24f3"
REPO4="cncf/udpa"
TAG4="6414d713912e988471d192940b62bf552b11793a"
mkdir -p $LIB_DIR/$REPO1
curl -L https://api.github.com/repos/$REPO1/tarball/$TAG1 | tar xz -C $LIB_DIR/$REPO1 --strip-components=1
mkdir -p $LIB_DIR/$REPO2
curl -L https://api.github.com/repos/$REPO2/tarball/$TAG2 | tar xz -C $LIB_DIR/$REPO2 --strip-components=1
mkdir -p $LIB_DIR/$REPO3
curl -L https://api.github.com/repos/$REPO3/tarball/$TAG3 | tar xz -C $LIB_DIR/$REPO3 --strip-components=1
mkdir -p $LIB_DIR/$REPO4
curl -L https://api.github.com/repos/$REPO4/tarball/$TAG4 | tar xz -C $LIB_DIR/$REPO4 --strip-components=1
gulpfile.js
const gulp = require('gulp');
const through2 = require('through2');
const fs = require('fs');
const path = require('path');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');
gulp.task('generate-sdk', function () {
const protoDir = 'proto';
const includeDirs = [
path.resolve(__dirname, 'lib/envoyproxy/data-plane-api'),
path.resolve(__dirname, 'lib/googleapis/googleapis'),
path.resolve(__dirname, 'lib/bufbuild/protoc-gen-validate'),
path.resolve(__dirname, 'lib/cncf/udpa'),
path.resolve(__dirname, 'proto/pomerium'),
]
return gulp.src(`${protoDir}/**/*.proto`)
.pipe(through2.obj(function (file, _, cb) {
const packageDefinition = protoLoader.loadSync(file.path, {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
includeDirs
});
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
const serviceName = Object.keys(protoDescriptor)[0]; // Assume the service name is the first key
const relativePath = path.relative(protoDir, path.dirname(file.path));
const outputFilePath = path.join('build', relativePath, `${serviceName}Client.js`);
const clientFactory = `
const grpc = require('@grpc/grpc-js');
const protoDescriptor = ${JSON.stringify(protoDescriptor)};
class ${serviceName}Client {
constructor(endpoint, channelCredentials) {
this.service = new protoDescriptor.${serviceName}(endpoint, channelCredentials);
}
}
module.exports = ${serviceName}Client;
`;
fs.mkdirSync(path.dirname(outputFilePath), { recursive: true });
fs.writeFileSync(outputFilePath, clientFactory);
cb(null, file);
}));
});
// Define a task that uses the generate file and includes the copy task
gulp.task('copy', () => {
return gulp.src('src/**/*')
.pipe(gulp.dest('build'))
});
// Define a task to clean the build directory
gulp.task('clean', async () => {
const del = await import('del');
return del(['build']);
});
// Default task
gulp.task('generate', gulp.series('copy','generate-sdk'));
gulp.task('default', gulp.series('clean', 'generate'));
src/package.json
{
"name": "@pomerium/enterprise-client",
"version": "1.0.0",
"description": "javascript sdk to access the pomerium api",
"main": "",
"scripts": {},
"author": "",
"license": "ISC",
"dependencies": {
"@grpc/grpc-js": "^1.9.13"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.