mirror of
https://github.com/hanzoai/ca.git
synced 2026-11-03 18:08:27 +00:00
223 lines
7.1 KiB
Go
223 lines
7.1 KiB
Go
// Code generated by protoc-gen-go-proxy. DO NOT EDIT.
|
|
// source: cis.proto
|
|
|
|
package proxypb
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/effective-security/porto/pkg/retriable"
|
|
"github.com/effective-security/porto/xhttp/correlation"
|
|
"github.com/effective-security/porto/xhttp/httperror"
|
|
"github.com/effective-security/trustyca/api/pb"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type proxyCISServer struct {
|
|
srv pb.CISServer
|
|
}
|
|
|
|
type proxyCISClient struct {
|
|
remote pb.CISClient
|
|
callOpts []grpc.CallOption
|
|
}
|
|
|
|
type postproxyCISClient struct {
|
|
client retriable.PostRequester
|
|
}
|
|
|
|
// CISServerToClient returns pb.CISClient
|
|
func CISServerToClient(srv pb.CISServer) pb.CISClient {
|
|
return &proxyCISServer{srv}
|
|
}
|
|
|
|
// NewCISClient returns instance of the CISClient
|
|
func NewCISClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) pb.CISServer {
|
|
return &proxyCISClient{
|
|
remote: pb.NewCISClient(conn),
|
|
callOpts: callOpts,
|
|
}
|
|
}
|
|
|
|
// NewCISClientFromProxy returns instance of CISClient
|
|
func NewCISClientFromProxy(proxy pb.CISClient) pb.CISServer {
|
|
return &proxyCISClient{
|
|
remote: proxy,
|
|
}
|
|
}
|
|
|
|
// NewCISClientFromProxy returns instance of CISClient
|
|
func NewHTTPCISClient(client retriable.PostRequester) pb.CISServer {
|
|
return &postproxyCISClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
// GetRoots returns the published trust anchors
|
|
func (s *proxyCISServer) GetRoots(ctx context.Context, req *pb.GetRootsRequest, opts ...grpc.CallOption) (*pb.RootsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetRoots(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetRoots returns the published trust anchors
|
|
func (s *proxyCISClient) GetRoots(ctx context.Context, req *pb.GetRootsRequest) (*pb.RootsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetRoots(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetRoots returns the published trust anchors
|
|
func (s *postproxyCISClient) GetRoots(ctx context.Context, req *pb.GetRootsRequest) (*pb.RootsResponse, error) {
|
|
var res pb.RootsResponse
|
|
path := pb.CIS_GetRoots_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetIssuer returns the issuer chain and status by IKID
|
|
func (s *proxyCISServer) GetIssuer(ctx context.Context, req *pb.GetIssuerInfoRequest, opts ...grpc.CallOption) (*pb.IssuerInfo, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetIssuer(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetIssuer returns the issuer chain and status by IKID
|
|
func (s *proxyCISClient) GetIssuer(ctx context.Context, req *pb.GetIssuerInfoRequest) (*pb.IssuerInfo, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetIssuer(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetIssuer returns the issuer chain and status by IKID
|
|
func (s *postproxyCISClient) GetIssuer(ctx context.Context, req *pb.GetIssuerInfoRequest) (*pb.IssuerInfo, error) {
|
|
var res pb.IssuerInfo
|
|
path := pb.CIS_GetIssuer_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetCertificate returns the certificate by ID, SKID, Sha256 or issuer
|
|
// and serial number
|
|
func (s *proxyCISServer) GetCertificate(ctx context.Context, req *pb.GetCertificateInfoRequest, opts ...grpc.CallOption) (*pb.CertificateResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetCertificate(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetCertificate returns the certificate by ID, SKID, Sha256 or issuer
|
|
// and serial number
|
|
func (s *proxyCISClient) GetCertificate(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetCertificate(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetCertificate returns the certificate by ID, SKID, Sha256 or issuer
|
|
// and serial number
|
|
func (s *postproxyCISClient) GetCertificate(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateResponse, error) {
|
|
var res pb.CertificateResponse
|
|
path := pb.CIS_GetCertificate_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetCertificateStatus returns the revocation status of a certificate
|
|
func (s *proxyCISServer) GetCertificateStatus(ctx context.Context, req *pb.GetCertificateInfoRequest, opts ...grpc.CallOption) (*pb.CertificateStatusResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetCertificateStatus(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetCertificateStatus returns the revocation status of a certificate
|
|
func (s *proxyCISClient) GetCertificateStatus(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateStatusResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetCertificateStatus(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetCertificateStatus returns the revocation status of a certificate
|
|
func (s *postproxyCISClient) GetCertificateStatus(ctx context.Context, req *pb.GetCertificateInfoRequest) (*pb.CertificateStatusResponse, error) {
|
|
var res pb.CertificateStatusResponse
|
|
path := pb.CIS_GetCertificateStatus_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// GetCRL returns the current CRL of the issuer in PEM format
|
|
func (s *proxyCISServer) GetCRL(ctx context.Context, req *pb.GetCrlRequest, opts ...grpc.CallOption) (*pb.CrlResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.GetCRL(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetCRL returns the current CRL of the issuer in PEM format
|
|
func (s *proxyCISClient) GetCRL(ctx context.Context, req *pb.GetCrlRequest) (*pb.CrlResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.GetCRL(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// GetCRL returns the current CRL of the issuer in PEM format
|
|
func (s *postproxyCISClient) GetCRL(ctx context.Context, req *pb.GetCrlRequest) (*pb.CrlResponse, error) {
|
|
var res pb.CrlResponse
|
|
path := pb.CIS_GetCRL_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|