Files
2026-10-31 05:36:03 -05:00

842 lines
30 KiB
Go

// Code generated by protoc-gen-go-proxy. DO NOT EDIT.
// source: ca.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"
"google.golang.org/protobuf/types/known/emptypb"
)
type proxyCAServer struct {
srv pb.CAServer
}
type proxyCAClient struct {
remote pb.CAClient
callOpts []grpc.CallOption
}
type postproxyCAClient struct {
client retriable.PostRequester
}
// CAServerToClient returns pb.CAClient
func CAServerToClient(srv pb.CAServer) pb.CAClient {
return &proxyCAServer{srv}
}
// NewCAClient returns instance of the CAClient
func NewCAClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) pb.CAServer {
return &proxyCAClient{
remote: pb.NewCAClient(conn),
callOpts: callOpts,
}
}
// NewCAClientFromProxy returns instance of CAClient
func NewCAClientFromProxy(proxy pb.CAClient) pb.CAServer {
return &proxyCAClient{
remote: proxy,
}
}
// NewCAClientFromProxy returns instance of CAClient
func NewHTTPCAClient(client retriable.PostRequester) pb.CAServer {
return &postproxyCAClient{
client: client,
}
}
// RegisterIssuer creates a new issuing authority for the tenant.
// The private key is generated in the configured crypto provider and
// never leaves it. The certificate is signed by the parent issuer,
// self-signed for Root type, or, when no parent is available, the issuer
// is created in Pending status with a CSR to be signed externally.
func (s *proxyCAServer) RegisterIssuer(ctx context.Context, req *pb.RegisterIssuerRequest, opts ...grpc.CallOption) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.RegisterIssuer(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RegisterIssuer creates a new issuing authority for the tenant.
// The private key is generated in the configured crypto provider and
// never leaves it. The certificate is signed by the parent issuer,
// self-signed for Root type, or, when no parent is available, the issuer
// is created in Pending status with a CSR to be signed externally.
func (s *proxyCAClient) RegisterIssuer(ctx context.Context, req *pb.RegisterIssuerRequest) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.RegisterIssuer(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RegisterIssuer creates a new issuing authority for the tenant.
// The private key is generated in the configured crypto provider and
// never leaves it. The certificate is signed by the parent issuer,
// self-signed for Root type, or, when no parent is available, the issuer
// is created in Pending status with a CSR to be signed externally.
func (s *postproxyCAClient) RegisterIssuer(ctx context.Context, req *pb.RegisterIssuerRequest) (*pb.Issuer, error) {
var res pb.Issuer
path := pb.CA_RegisterIssuer_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// UpdateIssuer updates the runtime configuration or status of an issuer.
// Status transitions: Active -> Archived -> Destroyed.
func (s *proxyCAServer) UpdateIssuer(ctx context.Context, req *pb.UpdateIssuerRequest, opts ...grpc.CallOption) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.UpdateIssuer(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// UpdateIssuer updates the runtime configuration or status of an issuer.
// Status transitions: Active -> Archived -> Destroyed.
func (s *proxyCAClient) UpdateIssuer(ctx context.Context, req *pb.UpdateIssuerRequest) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.UpdateIssuer(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// UpdateIssuer updates the runtime configuration or status of an issuer.
// Status transitions: Active -> Archived -> Destroyed.
func (s *postproxyCAClient) UpdateIssuer(ctx context.Context, req *pb.UpdateIssuerRequest) (*pb.Issuer, error) {
var res pb.Issuer
path := pb.CA_UpdateIssuer_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ImportIssuer registers an issuer from an existing certificate and key.
// The key is either referenced by a crypto provider URI or provided as
// PEM and stored protected. Used for bring-your-own-CA.
func (s *proxyCAServer) ImportIssuer(ctx context.Context, req *pb.ImportIssuerRequest, opts ...grpc.CallOption) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ImportIssuer(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ImportIssuer registers an issuer from an existing certificate and key.
// The key is either referenced by a crypto provider URI or provided as
// PEM and stored protected. Used for bring-your-own-CA.
func (s *proxyCAClient) ImportIssuer(ctx context.Context, req *pb.ImportIssuerRequest) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ImportIssuer(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ImportIssuer registers an issuer from an existing certificate and key.
// The key is either referenced by a crypto provider URI or provided as
// PEM and stored protected. Used for bring-your-own-CA.
func (s *postproxyCAClient) ImportIssuer(ctx context.Context, req *pb.ImportIssuerRequest) (*pb.Issuer, error) {
var res pb.Issuer
path := pb.CA_ImportIssuer_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ActivateIssuer sets the externally signed certificate for a Pending
// issuer and activates it.
func (s *proxyCAServer) ActivateIssuer(ctx context.Context, req *pb.ActivateIssuerRequest, opts ...grpc.CallOption) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ActivateIssuer(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ActivateIssuer sets the externally signed certificate for a Pending
// issuer and activates it.
func (s *proxyCAClient) ActivateIssuer(ctx context.Context, req *pb.ActivateIssuerRequest) (*pb.Issuer, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ActivateIssuer(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ActivateIssuer sets the externally signed certificate for a Pending
// issuer and activates it.
func (s *postproxyCAClient) ActivateIssuer(ctx context.Context, req *pb.ActivateIssuerRequest) (*pb.Issuer, error) {
var res pb.Issuer
path := pb.CA_ActivateIssuer_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// GetIssuer returns the issuer by ID, label or IKID
func (s *proxyCAServer) GetIssuer(ctx context.Context, req *pb.GetIssuerRequest, opts ...grpc.CallOption) (*pb.Issuer, 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 by ID, label or IKID
func (s *proxyCAClient) GetIssuer(ctx context.Context, req *pb.GetIssuerRequest) (*pb.Issuer, 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 by ID, label or IKID
func (s *postproxyCAClient) GetIssuer(ctx context.Context, req *pb.GetIssuerRequest) (*pb.Issuer, error) {
var res pb.Issuer
path := pb.CA_GetIssuer_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ListIssuers returns the tenant's issuers
func (s *proxyCAServer) ListIssuers(ctx context.Context, req *pb.ListIssuersRequest, opts ...grpc.CallOption) (*pb.IssuersResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ListIssuers(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListIssuers returns the tenant's issuers
func (s *proxyCAClient) ListIssuers(ctx context.Context, req *pb.ListIssuersRequest) (*pb.IssuersResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ListIssuers(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListIssuers returns the tenant's issuers
func (s *postproxyCAClient) ListIssuers(ctx context.Context, req *pb.ListIssuersRequest) (*pb.IssuersResponse, error) {
var res pb.IssuersResponse
path := pb.CA_ListIssuers_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// RegisterRoot registers an external trust anchor for the tenant.
// Roots created via RegisterIssuer are registered automatically.
func (s *proxyCAServer) RegisterRoot(ctx context.Context, req *pb.RegisterRootRequest, opts ...grpc.CallOption) (*pb.RootCertificate, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.RegisterRoot(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RegisterRoot registers an external trust anchor for the tenant.
// Roots created via RegisterIssuer are registered automatically.
func (s *proxyCAClient) RegisterRoot(ctx context.Context, req *pb.RegisterRootRequest) (*pb.RootCertificate, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.RegisterRoot(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RegisterRoot registers an external trust anchor for the tenant.
// Roots created via RegisterIssuer are registered automatically.
func (s *postproxyCAClient) RegisterRoot(ctx context.Context, req *pb.RegisterRootRequest) (*pb.RootCertificate, error) {
var res pb.RootCertificate
path := pb.CA_RegisterRoot_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ListRoots returns the tenant's trust anchors
func (s *proxyCAServer) ListRoots(ctx context.Context, req *pb.ListRootsRequest, opts ...grpc.CallOption) (*pb.RootsResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ListRoots(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListRoots returns the tenant's trust anchors
func (s *proxyCAClient) ListRoots(ctx context.Context, req *pb.ListRootsRequest) (*pb.RootsResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ListRoots(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListRoots returns the tenant's trust anchors
func (s *postproxyCAClient) ListRoots(ctx context.Context, req *pb.ListRootsRequest) (*pb.RootsResponse, error) {
var res pb.RootsResponse
path := pb.CA_ListRoots_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// RegisterProfile creates or replaces a certificate profile, keyed by
// (org, ProjectID, Label)
func (s *proxyCAServer) RegisterProfile(ctx context.Context, req *pb.RegisterProfileRequest, opts ...grpc.CallOption) (*pb.CertProfile, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.RegisterProfile(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RegisterProfile creates or replaces a certificate profile, keyed by
// (org, ProjectID, Label)
func (s *proxyCAClient) RegisterProfile(ctx context.Context, req *pb.RegisterProfileRequest) (*pb.CertProfile, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.RegisterProfile(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RegisterProfile creates or replaces a certificate profile, keyed by
// (org, ProjectID, Label)
func (s *postproxyCAClient) RegisterProfile(ctx context.Context, req *pb.RegisterProfileRequest) (*pb.CertProfile, error) {
var res pb.CertProfile
path := pb.CA_RegisterProfile_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// GetProfile returns the profile by ID or label
func (s *proxyCAServer) GetProfile(ctx context.Context, req *pb.GetProfileRequest, opts ...grpc.CallOption) (*pb.CertProfile, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.GetProfile(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// GetProfile returns the profile by ID or label
func (s *proxyCAClient) GetProfile(ctx context.Context, req *pb.GetProfileRequest) (*pb.CertProfile, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.GetProfile(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// GetProfile returns the profile by ID or label
func (s *postproxyCAClient) GetProfile(ctx context.Context, req *pb.GetProfileRequest) (*pb.CertProfile, error) {
var res pb.CertProfile
path := pb.CA_GetProfile_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ListProfiles returns the tenant's profiles
func (s *proxyCAServer) ListProfiles(ctx context.Context, req *pb.ListProfilesRequest, opts ...grpc.CallOption) (*pb.ProfilesResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ListProfiles(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListProfiles returns the tenant's profiles
func (s *proxyCAClient) ListProfiles(ctx context.Context, req *pb.ListProfilesRequest) (*pb.ProfilesResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ListProfiles(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListProfiles returns the tenant's profiles
func (s *postproxyCAClient) ListProfiles(ctx context.Context, req *pb.ListProfilesRequest) (*pb.ProfilesResponse, error) {
var res pb.ProfilesResponse
path := pb.CA_ListProfiles_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// DeleteProfile deletes a profile
func (s *proxyCAServer) DeleteProfile(ctx context.Context, req *pb.DeleteProfileRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.DeleteProfile(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// DeleteProfile deletes a profile
func (s *proxyCAClient) DeleteProfile(ctx context.Context, req *pb.DeleteProfileRequest) (*emptypb.Empty, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.DeleteProfile(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// DeleteProfile deletes a profile
func (s *postproxyCAClient) DeleteProfile(ctx context.Context, req *pb.DeleteProfileRequest) (*emptypb.Empty, error) {
var res emptypb.Empty
path := pb.CA_DeleteProfile_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// SignCertificate signs a certificate request with the profile's issuer
func (s *proxyCAServer) SignCertificate(ctx context.Context, req *pb.SignCertificateRequest, opts ...grpc.CallOption) (*pb.CertificateResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.SignCertificate(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// SignCertificate signs a certificate request with the profile's issuer
func (s *proxyCAClient) SignCertificate(ctx context.Context, req *pb.SignCertificateRequest) (*pb.CertificateResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.SignCertificate(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// SignCertificate signs a certificate request with the profile's issuer
func (s *postproxyCAClient) SignCertificate(ctx context.Context, req *pb.SignCertificateRequest) (*pb.CertificateResponse, error) {
var res pb.CertificateResponse
path := pb.CA_SignCertificate_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 *proxyCAServer) GetCertificate(ctx context.Context, req *pb.GetCertificateRequest, 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 *proxyCAClient) GetCertificate(ctx context.Context, req *pb.GetCertificateRequest) (*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 *postproxyCAClient) GetCertificate(ctx context.Context, req *pb.GetCertificateRequest) (*pb.CertificateResponse, error) {
var res pb.CertificateResponse
path := pb.CA_GetCertificate_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ListCertificates returns the tenant's certificates, newest first
func (s *proxyCAServer) ListCertificates(ctx context.Context, req *pb.ListCertificatesRequest, opts ...grpc.CallOption) (*pb.CertificatesResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ListCertificates(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListCertificates returns the tenant's certificates, newest first
func (s *proxyCAClient) ListCertificates(ctx context.Context, req *pb.ListCertificatesRequest) (*pb.CertificatesResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ListCertificates(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListCertificates returns the tenant's certificates, newest first
func (s *postproxyCAClient) ListCertificates(ctx context.Context, req *pb.ListCertificatesRequest) (*pb.CertificatesResponse, error) {
var res pb.CertificatesResponse
path := pb.CA_ListCertificates_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// UpdateCertificateLabel updates the client-provided label and metadata
func (s *proxyCAServer) UpdateCertificateLabel(ctx context.Context, req *pb.UpdateCertificateLabelRequest, opts ...grpc.CallOption) (*pb.CertificateResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.UpdateCertificateLabel(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// UpdateCertificateLabel updates the client-provided label and metadata
func (s *proxyCAClient) UpdateCertificateLabel(ctx context.Context, req *pb.UpdateCertificateLabelRequest) (*pb.CertificateResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.UpdateCertificateLabel(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// UpdateCertificateLabel updates the client-provided label and metadata
func (s *postproxyCAClient) UpdateCertificateLabel(ctx context.Context, req *pb.UpdateCertificateLabelRequest) (*pb.CertificateResponse, error) {
var res pb.CertificateResponse
path := pb.CA_UpdateCertificateLabel_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// RevokeCertificate revokes the certificate
func (s *proxyCAServer) RevokeCertificate(ctx context.Context, req *pb.RevokeCertificateRequest, opts ...grpc.CallOption) (*pb.RevokedCertificateResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.RevokeCertificate(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RevokeCertificate revokes the certificate
func (s *proxyCAClient) RevokeCertificate(ctx context.Context, req *pb.RevokeCertificateRequest) (*pb.RevokedCertificateResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.RevokeCertificate(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// RevokeCertificate revokes the certificate
func (s *postproxyCAClient) RevokeCertificate(ctx context.Context, req *pb.RevokeCertificateRequest) (*pb.RevokedCertificateResponse, error) {
var res pb.RevokedCertificateResponse
path := pb.CA_RevokeCertificate_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// ListRevokedCertificates returns the tenant's revoked certificates
func (s *proxyCAServer) ListRevokedCertificates(ctx context.Context, req *pb.ListRevokedCertificatesRequest, opts ...grpc.CallOption) (*pb.RevokedCertificatesResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.ListRevokedCertificates(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListRevokedCertificates returns the tenant's revoked certificates
func (s *proxyCAClient) ListRevokedCertificates(ctx context.Context, req *pb.ListRevokedCertificatesRequest) (*pb.RevokedCertificatesResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.ListRevokedCertificates(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// ListRevokedCertificates returns the tenant's revoked certificates
func (s *postproxyCAClient) ListRevokedCertificates(ctx context.Context, req *pb.ListRevokedCertificatesRequest) (*pb.RevokedCertificatesResponse, error) {
var res pb.RevokedCertificatesResponse
path := pb.CA_ListRevokedCertificates_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
func (s *proxyCAServer) 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
func (s *proxyCAClient) 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
func (s *postproxyCAClient) GetCRL(ctx context.Context, req *pb.GetCrlRequest) (*pb.CrlResponse, error) {
var res pb.CrlResponse
path := pb.CA_GetCRL_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// PublishCrls generates and publishes CRLs on demand: the CRL of the
// issuer of the IKID, or the due CRLs of the issuers in scope. A project
// Admin and an API key restricted to a project publish for their project.
// The scheduled CRL renewal task publishes the due CRLs of every org
// in-process.
func (s *proxyCAServer) PublishCrls(ctx context.Context, req *pb.PublishCrlsRequest, opts ...grpc.CallOption) (*pb.CrlsResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.PublishCrls(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// PublishCrls generates and publishes CRLs on demand: the CRL of the
// issuer of the IKID, or the due CRLs of the issuers in scope. A project
// Admin and an API key restricted to a project publish for their project.
// The scheduled CRL renewal task publishes the due CRLs of every org
// in-process.
func (s *proxyCAClient) PublishCrls(ctx context.Context, req *pb.PublishCrlsRequest) (*pb.CrlsResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.PublishCrls(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// PublishCrls generates and publishes CRLs on demand: the CRL of the
// issuer of the IKID, or the due CRLs of the issuers in scope. A project
// Admin and an API key restricted to a project publish for their project.
// The scheduled CRL renewal task publishes the due CRLs of every org
// in-process.
func (s *postproxyCAClient) PublishCrls(ctx context.Context, req *pb.PublishCrlsRequest) (*pb.CrlsResponse, error) {
var res pb.CrlsResponse
path := pb.CA_PublishCrls_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// SignOCSP signs an OCSP response; the AIA OCSP responder calls
// Backend.SignOCSP.
func (s *proxyCAServer) SignOCSP(ctx context.Context, req *pb.OCSPRequest, opts ...grpc.CallOption) (*pb.OCSPResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.SignOCSP(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// SignOCSP signs an OCSP response; the AIA OCSP responder calls
// Backend.SignOCSP.
func (s *proxyCAClient) SignOCSP(ctx context.Context, req *pb.OCSPRequest) (*pb.OCSPResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.SignOCSP(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// SignOCSP signs an OCSP response; the AIA OCSP responder calls
// Backend.SignOCSP.
func (s *postproxyCAClient) SignOCSP(ctx context.Context, req *pb.OCSPRequest) (*pb.OCSPResponse, error) {
var res pb.OCSPResponse
path := pb.CA_SignOCSP_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}
// GetSummary returns the counts of the tenant's dashboard: the issuers
// by status, the certificates by status and by expiry, and the issuers
// that publish CRLs by the state of their CRL, for the org or for one
// project. Without a project, a member with project grants only gets
// the org-wide rows and those of its projects, as the lists do.
func (s *proxyCAServer) GetSummary(ctx context.Context, req *pb.GetSummaryRequest, opts ...grpc.CallOption) (*pb.SummaryResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.srv.GetSummary(ctx, req)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// GetSummary returns the counts of the tenant's dashboard: the issuers
// by status, the certificates by status and by expiry, and the issuers
// that publish CRLs by the state of their CRL, for the org or for one
// project. Without a project, a member with project grants only gets
// the org-wide rows and those of its projects, as the lists do.
func (s *proxyCAClient) GetSummary(ctx context.Context, req *pb.GetSummaryRequest) (*pb.SummaryResponse, error) {
// add correlation ID to outgoing RPC calls
ctx = correlation.WithMetaFromContext(ctx)
res, err := s.remote.GetSummary(ctx, req, s.callOpts...)
if err != nil {
return nil, httperror.NewFromPb(err)
}
return res, nil
}
// GetSummary returns the counts of the tenant's dashboard: the issuers
// by status, the certificates by status and by expiry, and the issuers
// that publish CRLs by the state of their CRL, for the org or for one
// project. Without a project, a member with project grants only gets
// the org-wide rows and those of its projects, as the lists do.
func (s *postproxyCAClient) GetSummary(ctx context.Context, req *pb.GetSummaryRequest) (*pb.SummaryResponse, error) {
var res pb.SummaryResponse
path := pb.CA_GetSummary_FullMethodName
_, _, err := s.client.Post(ctx, path, req, &res)
if err != nil {
return nil, err
}
return &res, nil
}