mirror of
https://github.com/hanzoai/ca.git
synced 2026-11-03 18:08:27 +00:00
302 lines
9.5 KiB
Go
302 lines
9.5 KiB
Go
// Code generated by protoc-gen-go-proxy. DO NOT EDIT.
|
|
// source: admin.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"
|
|
"github.com/effective-security/trustyca/privpb"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type proxyAdminServer struct {
|
|
srv privpb.AdminServer
|
|
}
|
|
|
|
type proxyAdminClient struct {
|
|
remote privpb.AdminClient
|
|
callOpts []grpc.CallOption
|
|
}
|
|
|
|
type postproxyAdminClient struct {
|
|
client retriable.PostRequester
|
|
}
|
|
|
|
// AdminServerToClient returns privpb.AdminClient
|
|
func AdminServerToClient(srv privpb.AdminServer) privpb.AdminClient {
|
|
return &proxyAdminServer{srv}
|
|
}
|
|
|
|
// NewAdminClient returns instance of the AdminClient
|
|
func NewAdminClient(conn *grpc.ClientConn, callOpts []grpc.CallOption) privpb.AdminServer {
|
|
return &proxyAdminClient{
|
|
remote: privpb.NewAdminClient(conn),
|
|
callOpts: callOpts,
|
|
}
|
|
}
|
|
|
|
// NewAdminClientFromProxy returns instance of AdminClient
|
|
func NewAdminClientFromProxy(proxy privpb.AdminClient) privpb.AdminServer {
|
|
return &proxyAdminClient{
|
|
remote: proxy,
|
|
}
|
|
}
|
|
|
|
// NewAdminClientFromProxy returns instance of AdminClient
|
|
func NewHTTPAdminClient(client retriable.PostRequester) privpb.AdminServer {
|
|
return &postproxyAdminClient{
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
// ListOrgs lists orgs
|
|
func (s *proxyAdminServer) ListOrgs(ctx context.Context, req *privpb.ListOrgsRequest, opts ...grpc.CallOption) (*pb.OrgsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.ListOrgs(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListOrgs lists orgs
|
|
func (s *proxyAdminClient) ListOrgs(ctx context.Context, req *privpb.ListOrgsRequest) (*pb.OrgsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.ListOrgs(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// ListOrgs lists orgs
|
|
func (s *postproxyAdminClient) ListOrgs(ctx context.Context, req *privpb.ListOrgsRequest) (*pb.OrgsResponse, error) {
|
|
var res pb.OrgsResponse
|
|
path := privpb.Admin_ListOrgs_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// // GetOrg returns an org with its budget
|
|
// rpc GetOrg(GetOrgRequest) returns (pb.Org) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/GetOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org get";
|
|
// }
|
|
// // CreateOrg creates an org owned by an existing user
|
|
// rpc CreateOrg(CreateOrgRequest)
|
|
// returns (pb.Organization) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/CreateOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org create";
|
|
// }
|
|
// // UpdateOrg updates an org
|
|
// rpc UpdateOrg(UpdateOrgRequest)
|
|
// returns (pb.Organization) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/UpdateOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org update";
|
|
// }
|
|
// // DeleteOrg deletes an org that has no projects
|
|
// rpc DeleteOrg(DeleteOrgRequest)
|
|
// returns (google.protobuf.Empty) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/DeleteOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org delete";
|
|
// }
|
|
func (s *proxyAdminServer) ListProjects(ctx context.Context, req *privpb.ListProjectsRequest, opts ...grpc.CallOption) (*pb.ProjectsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.srv.ListProjects(ctx, req)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// // GetOrg returns an org with its budget
|
|
// rpc GetOrg(GetOrgRequest) returns (pb.Org) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/GetOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org get";
|
|
// }
|
|
// // CreateOrg creates an org owned by an existing user
|
|
// rpc CreateOrg(CreateOrgRequest)
|
|
// returns (pb.Organization) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/CreateOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org create";
|
|
// }
|
|
// // UpdateOrg updates an org
|
|
// rpc UpdateOrg(UpdateOrgRequest)
|
|
// returns (pb.Organization) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/UpdateOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org update";
|
|
// }
|
|
// // DeleteOrg deletes an org that has no projects
|
|
// rpc DeleteOrg(DeleteOrgRequest)
|
|
// returns (google.protobuf.Empty) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/DeleteOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org delete";
|
|
// }
|
|
func (s *proxyAdminClient) ListProjects(ctx context.Context, req *privpb.ListProjectsRequest) (*pb.ProjectsResponse, error) {
|
|
// add correlation ID to outgoing RPC calls
|
|
ctx = correlation.WithMetaFromContext(ctx)
|
|
res, err := s.remote.ListProjects(ctx, req, s.callOpts...)
|
|
if err != nil {
|
|
return nil, httperror.NewFromPb(err)
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
// // GetOrg returns an org with its budget
|
|
// rpc GetOrg(GetOrgRequest) returns (pb.Org) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/GetOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org get";
|
|
// }
|
|
// // CreateOrg creates an org owned by an existing user
|
|
// rpc CreateOrg(CreateOrgRequest)
|
|
// returns (pb.Organization) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/CreateOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org create";
|
|
// }
|
|
// // UpdateOrg updates an org
|
|
// rpc UpdateOrg(UpdateOrgRequest)
|
|
// returns (pb.Organization) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/UpdateOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org update";
|
|
// }
|
|
// // DeleteOrg deletes an org that has no projects
|
|
// rpc DeleteOrg(DeleteOrgRequest)
|
|
// returns (google.protobuf.Empty) {
|
|
// option (google.api.http) = {
|
|
// post: "/privpb.Admin/DeleteOrganization",
|
|
// body: "*"
|
|
// };
|
|
// option (es.api.cli_cmd) = "org delete";
|
|
// }
|
|
func (s *postproxyAdminClient) ListProjects(ctx context.Context, req *privpb.ListProjectsRequest) (*pb.ProjectsResponse, error) {
|
|
var res pb.ProjectsResponse
|
|
path := privpb.Admin_ListProjects_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// ListIssuers lists the issuers of every org and of the platform, newest
|
|
// first, for support staff; the tenant view of an org is CA.ListIssuers.
|
|
// Private key material is never returned.
|
|
func (s *proxyAdminServer) ListIssuers(ctx context.Context, req *privpb.ListAllIssuersRequest, 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 lists the issuers of every org and of the platform, newest
|
|
// first, for support staff; the tenant view of an org is CA.ListIssuers.
|
|
// Private key material is never returned.
|
|
func (s *proxyAdminClient) ListIssuers(ctx context.Context, req *privpb.ListAllIssuersRequest) (*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 lists the issuers of every org and of the platform, newest
|
|
// first, for support staff; the tenant view of an org is CA.ListIssuers.
|
|
// Private key material is never returned.
|
|
func (s *postproxyAdminClient) ListIssuers(ctx context.Context, req *privpb.ListAllIssuersRequest) (*pb.IssuersResponse, error) {
|
|
var res pb.IssuersResponse
|
|
path := privpb.Admin_ListIssuers_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|
|
|
|
// ListCertificates lists the certificates of every org and of the
|
|
// platform, newest first, for support staff; the tenant view of an org
|
|
// is CA.ListCertificates
|
|
func (s *proxyAdminServer) ListCertificates(ctx context.Context, req *privpb.ListAllCertificatesRequest, 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 lists the certificates of every org and of the
|
|
// platform, newest first, for support staff; the tenant view of an org
|
|
// is CA.ListCertificates
|
|
func (s *proxyAdminClient) ListCertificates(ctx context.Context, req *privpb.ListAllCertificatesRequest) (*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 lists the certificates of every org and of the
|
|
// platform, newest first, for support staff; the tenant view of an org
|
|
// is CA.ListCertificates
|
|
func (s *postproxyAdminClient) ListCertificates(ctx context.Context, req *privpb.ListAllCertificatesRequest) (*pb.CertificatesResponse, error) {
|
|
var res pb.CertificatesResponse
|
|
path := privpb.Admin_ListCertificates_FullMethodName
|
|
_, _, err := s.client.Post(ctx, path, req, &res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &res, nil
|
|
}
|