Remove majordomo client and rename administrator to admin.

This commit is contained in:
Mariano Cano 2021-05-24 12:43:23 -07:00
parent 71afc413bf
commit 35cfa5b8a2
8 changed files with 567 additions and 2196 deletions

240
linkedca/admin.pb.go Normal file
View file

@ -0,0 +1,240 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.15.8
// source: linkedca/admin.proto
package linkedca
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Admin_Type int32
const (
Admin_UNKNOWN Admin_Type = 0
Admin_ADMIN Admin_Type = 1
Admin_SUPER_ADMIN Admin_Type = 2
)
// Enum value maps for Admin_Type.
var (
Admin_Type_name = map[int32]string{
0: "UNKNOWN",
1: "ADMIN",
2: "SUPER_ADMIN",
}
Admin_Type_value = map[string]int32{
"UNKNOWN": 0,
"ADMIN": 1,
"SUPER_ADMIN": 2,
}
)
func (x Admin_Type) Enum() *Admin_Type {
p := new(Admin_Type)
*p = x
return p
}
func (x Admin_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Admin_Type) Descriptor() protoreflect.EnumDescriptor {
return file_linkedca_admin_proto_enumTypes[0].Descriptor()
}
func (Admin_Type) Type() protoreflect.EnumType {
return &file_linkedca_admin_proto_enumTypes[0]
}
func (x Admin_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Admin_Type.Descriptor instead.
func (Admin_Type) EnumDescriptor() ([]byte, []int) {
return file_linkedca_admin_proto_rawDescGZIP(), []int{0, 0}
}
type Admin struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
AuthorityId string `protobuf:"bytes,2,opt,name=authority_id,json=authorityId,proto3" json:"authority_id,omitempty"`
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
ProvisionerId string `protobuf:"bytes,4,opt,name=provisioner_id,json=provisionerId,proto3" json:"provisioner_id,omitempty"`
Type Admin_Type `protobuf:"varint,5,opt,name=type,proto3,enum=linkedca.Admin_Type" json:"type,omitempty"`
}
func (x *Admin) Reset() {
*x = Admin{}
if protoimpl.UnsafeEnabled {
mi := &file_linkedca_admin_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Admin) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Admin) ProtoMessage() {}
func (x *Admin) ProtoReflect() protoreflect.Message {
mi := &file_linkedca_admin_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Admin.ProtoReflect.Descriptor instead.
func (*Admin) Descriptor() ([]byte, []int) {
return file_linkedca_admin_proto_rawDescGZIP(), []int{0}
}
func (x *Admin) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Admin) GetAuthorityId() string {
if x != nil {
return x.AuthorityId
}
return ""
}
func (x *Admin) GetSubject() string {
if x != nil {
return x.Subject
}
return ""
}
func (x *Admin) GetProvisionerId() string {
if x != nil {
return x.ProvisionerId
}
return ""
}
func (x *Admin) GetType() Admin_Type {
if x != nil {
return x.Type
}
return Admin_UNKNOWN
}
var File_linkedca_admin_proto protoreflect.FileDescriptor
var file_linkedca_admin_proto_rawDesc = []byte{
0x0a, 0x14, 0x6c, 0x69, 0x6e, 0x6b, 0x65, 0x64, 0x63, 0x61, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x6c, 0x69, 0x6e, 0x6b, 0x65, 0x64, 0x63, 0x61,
0x22, 0xd6, 0x01, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x75,
0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0b, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x76, 0x69,
0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x28,
0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6c,
0x69, 0x6e, 0x6b, 0x65, 0x64, 0x63, 0x61, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x54, 0x79,
0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x2f, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65,
0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a,
0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x55, 0x50, 0x45,
0x52, 0x5f, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x73, 0x74, 0x65,
0x70, 0x2f, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x2f, 0x6c,
0x69, 0x6e, 0x6b, 0x65, 0x64, 0x63, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_linkedca_admin_proto_rawDescOnce sync.Once
file_linkedca_admin_proto_rawDescData = file_linkedca_admin_proto_rawDesc
)
func file_linkedca_admin_proto_rawDescGZIP() []byte {
file_linkedca_admin_proto_rawDescOnce.Do(func() {
file_linkedca_admin_proto_rawDescData = protoimpl.X.CompressGZIP(file_linkedca_admin_proto_rawDescData)
})
return file_linkedca_admin_proto_rawDescData
}
var file_linkedca_admin_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_linkedca_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_linkedca_admin_proto_goTypes = []interface{}{
(Admin_Type)(0), // 0: linkedca.Admin.Type
(*Admin)(nil), // 1: linkedca.Admin
}
var file_linkedca_admin_proto_depIdxs = []int32{
0, // 0: linkedca.Admin.type:type_name -> linkedca.Admin.Type
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_linkedca_admin_proto_init() }
func file_linkedca_admin_proto_init() {
if File_linkedca_admin_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_linkedca_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Admin); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_linkedca_admin_proto_rawDesc,
NumEnums: 1,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_linkedca_admin_proto_goTypes,
DependencyIndexes: file_linkedca_admin_proto_depIdxs,
EnumInfos: file_linkedca_admin_proto_enumTypes,
MessageInfos: file_linkedca_admin_proto_msgTypes,
}.Build()
File_linkedca_admin_proto = out.File
file_linkedca_admin_proto_rawDesc = nil
file_linkedca_admin_proto_goTypes = nil
file_linkedca_admin_proto_depIdxs = nil
}

18
linkedca/admin.proto Normal file
View file

@ -0,0 +1,18 @@
syntax = "proto3";
package linkedca;
option go_package = "github.com/smallstep/certificates/linkedca";
message Admin {
enum Type {
UNKNOWN = 0;
ADMIN = 1;
SUPER_ADMIN = 2;
}
string id = 1;
string authority_id = 2;
string subject = 3;
string provisioner_id = 4;
Type type = 5;
}

View file

@ -1,3 +1,3 @@
package majordomo package majordomo
//go:generate protoc --proto_path=.. --go_out=.. --go-grpc_out=.. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative majordomo/provisioners.proto majordomo/majordomo.proto //go:generate protoc --proto_path=.. --go_out=.. --go-grpc_out=.. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative linkedca/provisioners.proto linkedca/admin.proto

File diff suppressed because it is too large Load diff

View file

@ -1,102 +0,0 @@
syntax = "proto3";
package majordomo;
option go_package = "github.com/smallstep/certificates/majordomo";
import "majordomo/provisioners.proto";
// Majordomo is the public service used to sync configurations to CA's and post
// certificates.
service Majordomo {
// Login creates signs a given CSR and returns the certificate that will be
// used for authentication.
rpc Login(LoginRequest) returns (LoginResponse);
// GetConfiguration returns the full configuration of an authority.
rpc GetConfiguration(ConfigurationRequest) returns (ConfigurationResponse);
// StreamConfiguration streams the full configuration of an authority. This
// method is not yet supported.
rpc StreamConfiguration(ConfigurationRequest) returns (stream ConfigurationResponse);
// CreateProvisioner adds a new provisioner to the majordomo authority and
// returns the proto representation.
rpc CreateProvisioner(CreateProvisionerRequest) returns (Provisioner);
// DeleteProvisioner deletes a previously created provisioner.
rpc DeleteProvisioner(DeleteProvisionerRequest) returns (Provisioner);
// CreateAdministrator adds a new admin user to the majordomo authority.
// Admin users can add or delete provisioners.
rpc CreateAdministrator(CreateAdministratorRequest) returns (Administrator);
// DeleteAdministrator deletes a previously created admin user.
rpc DeleteAdministrator(DeleteAdministratorRequest) returns (Administrator);
// PostCertificate sends a signed X.509 certificate to majordomo.
rpc PostCertificate(CertificateRequest) returns (CertificateResponse);
// PostSSHCertificate sends a signed SSH certificate to majordomo.
rpc PostSSHCertificate(SSHCertificateRequest) returns (SSHCertificateResponse);
// RevokeCertificate marks an X.509 certificate as revoked.
rpc RevokeCertificate(TODO) returns (TODO);
// RevokeSSHCertificate marks an SSH certificate as revoked.
rpc RevokeSSHCertificate(TODO) returns (TODO);
}
message TODO {}
message LoginRequest {
string authority_id = 1;
string username = 2;
string password = 3;
string pem_certificate_request = 4;
}
message LoginResponse {
string pem_certificate = 1;
string pem_certificate_chain = 2;
}
message ConfigurationRequest {
// todo
}
message ConfigurationResponse {
repeated Provisioner provisioners = 1;
repeated Administrator admins = 2;
}
message CreateProvisionerRequest {
Provisioner.Type type = 1;
string name = 2;
ProvisionerDetails details = 3;
Claims claims = 4;
}
message DeleteProvisionerRequest {
string id = 1;
}
message CreateAdministratorRequest {
string name = 1;
string provisioner_id = 2;
Administrator.Type type = 3;
}
message DeleteAdministratorRequest {
string id = 1;
}
message CertificateRequest {
string pem_certificate = 1;
string pem_certificate_chain = 2;
}
message CertificateResponse {
string id = 1;
}
message SSHCertificateRequest {
string certificate = 1;
}
message SSHCertificateResponse {
string id = 1;
}

View file

@ -1,519 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package majordomo
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// MajordomoClient is the client API for Majordomo service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MajordomoClient interface {
// Login creates signs a given CSR and returns the certificate that will be
// used for authentication.
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
// GetConfiguration returns the full configuration of an authority.
GetConfiguration(ctx context.Context, in *ConfigurationRequest, opts ...grpc.CallOption) (*ConfigurationResponse, error)
// StreamConfiguration streams the full configuration of an authority. This
// method is not yet supported.
StreamConfiguration(ctx context.Context, in *ConfigurationRequest, opts ...grpc.CallOption) (Majordomo_StreamConfigurationClient, error)
// CreateProvisioner adds a new provisioner to the majordomo authority and
// returns the proto representation.
CreateProvisioner(ctx context.Context, in *CreateProvisionerRequest, opts ...grpc.CallOption) (*Provisioner, error)
// DeleteProvisioner deletes a previously created provisioner.
DeleteProvisioner(ctx context.Context, in *DeleteProvisionerRequest, opts ...grpc.CallOption) (*Provisioner, error)
// CreateAdministrator adds a new admin user to the majordomo authority.
// Admin users can add or delete provisioners.
CreateAdministrator(ctx context.Context, in *CreateAdministratorRequest, opts ...grpc.CallOption) (*Administrator, error)
// DeleteAdministrator deletes a previously created admin user.
DeleteAdministrator(ctx context.Context, in *DeleteAdministratorRequest, opts ...grpc.CallOption) (*Administrator, error)
// PostCertificate sends a signed X.509 certificate to majordomo.
PostCertificate(ctx context.Context, in *CertificateRequest, opts ...grpc.CallOption) (*CertificateResponse, error)
// PostSSHCertificate sends a signed SSH certificate to majordomo.
PostSSHCertificate(ctx context.Context, in *SSHCertificateRequest, opts ...grpc.CallOption) (*SSHCertificateResponse, error)
// RevokeCertificate marks an X.509 certificate as revoked.
RevokeCertificate(ctx context.Context, in *TODO, opts ...grpc.CallOption) (*TODO, error)
// RevokeSSHCertificate marks an SSH certificate as revoked.
RevokeSSHCertificate(ctx context.Context, in *TODO, opts ...grpc.CallOption) (*TODO, error)
}
type majordomoClient struct {
cc grpc.ClientConnInterface
}
func NewMajordomoClient(cc grpc.ClientConnInterface) MajordomoClient {
return &majordomoClient{cc}
}
func (c *majordomoClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) {
out := new(LoginResponse)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/Login", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) GetConfiguration(ctx context.Context, in *ConfigurationRequest, opts ...grpc.CallOption) (*ConfigurationResponse, error) {
out := new(ConfigurationResponse)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/GetConfiguration", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) StreamConfiguration(ctx context.Context, in *ConfigurationRequest, opts ...grpc.CallOption) (Majordomo_StreamConfigurationClient, error) {
stream, err := c.cc.NewStream(ctx, &Majordomo_ServiceDesc.Streams[0], "/majordomo.Majordomo/StreamConfiguration", opts...)
if err != nil {
return nil, err
}
x := &majordomoStreamConfigurationClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Majordomo_StreamConfigurationClient interface {
Recv() (*ConfigurationResponse, error)
grpc.ClientStream
}
type majordomoStreamConfigurationClient struct {
grpc.ClientStream
}
func (x *majordomoStreamConfigurationClient) Recv() (*ConfigurationResponse, error) {
m := new(ConfigurationResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *majordomoClient) CreateProvisioner(ctx context.Context, in *CreateProvisionerRequest, opts ...grpc.CallOption) (*Provisioner, error) {
out := new(Provisioner)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/CreateProvisioner", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) DeleteProvisioner(ctx context.Context, in *DeleteProvisionerRequest, opts ...grpc.CallOption) (*Provisioner, error) {
out := new(Provisioner)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/DeleteProvisioner", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) CreateAdministrator(ctx context.Context, in *CreateAdministratorRequest, opts ...grpc.CallOption) (*Administrator, error) {
out := new(Administrator)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/CreateAdministrator", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) DeleteAdministrator(ctx context.Context, in *DeleteAdministratorRequest, opts ...grpc.CallOption) (*Administrator, error) {
out := new(Administrator)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/DeleteAdministrator", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) PostCertificate(ctx context.Context, in *CertificateRequest, opts ...grpc.CallOption) (*CertificateResponse, error) {
out := new(CertificateResponse)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/PostCertificate", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) PostSSHCertificate(ctx context.Context, in *SSHCertificateRequest, opts ...grpc.CallOption) (*SSHCertificateResponse, error) {
out := new(SSHCertificateResponse)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/PostSSHCertificate", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) RevokeCertificate(ctx context.Context, in *TODO, opts ...grpc.CallOption) (*TODO, error) {
out := new(TODO)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/RevokeCertificate", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *majordomoClient) RevokeSSHCertificate(ctx context.Context, in *TODO, opts ...grpc.CallOption) (*TODO, error) {
out := new(TODO)
err := c.cc.Invoke(ctx, "/majordomo.Majordomo/RevokeSSHCertificate", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MajordomoServer is the server API for Majordomo service.
// All implementations must embed UnimplementedMajordomoServer
// for forward compatibility
type MajordomoServer interface {
// Login creates signs a given CSR and returns the certificate that will be
// used for authentication.
Login(context.Context, *LoginRequest) (*LoginResponse, error)
// GetConfiguration returns the full configuration of an authority.
GetConfiguration(context.Context, *ConfigurationRequest) (*ConfigurationResponse, error)
// StreamConfiguration streams the full configuration of an authority. This
// method is not yet supported.
StreamConfiguration(*ConfigurationRequest, Majordomo_StreamConfigurationServer) error
// CreateProvisioner adds a new provisioner to the majordomo authority and
// returns the proto representation.
CreateProvisioner(context.Context, *CreateProvisionerRequest) (*Provisioner, error)
// DeleteProvisioner deletes a previously created provisioner.
DeleteProvisioner(context.Context, *DeleteProvisionerRequest) (*Provisioner, error)
// CreateAdministrator adds a new admin user to the majordomo authority.
// Admin users can add or delete provisioners.
CreateAdministrator(context.Context, *CreateAdministratorRequest) (*Administrator, error)
// DeleteAdministrator deletes a previously created admin user.
DeleteAdministrator(context.Context, *DeleteAdministratorRequest) (*Administrator, error)
// PostCertificate sends a signed X.509 certificate to majordomo.
PostCertificate(context.Context, *CertificateRequest) (*CertificateResponse, error)
// PostSSHCertificate sends a signed SSH certificate to majordomo.
PostSSHCertificate(context.Context, *SSHCertificateRequest) (*SSHCertificateResponse, error)
// RevokeCertificate marks an X.509 certificate as revoked.
RevokeCertificate(context.Context, *TODO) (*TODO, error)
// RevokeSSHCertificate marks an SSH certificate as revoked.
RevokeSSHCertificate(context.Context, *TODO) (*TODO, error)
mustEmbedUnimplementedMajordomoServer()
}
// UnimplementedMajordomoServer must be embedded to have forward compatible implementations.
type UnimplementedMajordomoServer struct {
}
func (UnimplementedMajordomoServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedMajordomoServer) GetConfiguration(context.Context, *ConfigurationRequest) (*ConfigurationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetConfiguration not implemented")
}
func (UnimplementedMajordomoServer) StreamConfiguration(*ConfigurationRequest, Majordomo_StreamConfigurationServer) error {
return status.Errorf(codes.Unimplemented, "method StreamConfiguration not implemented")
}
func (UnimplementedMajordomoServer) CreateProvisioner(context.Context, *CreateProvisionerRequest) (*Provisioner, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateProvisioner not implemented")
}
func (UnimplementedMajordomoServer) DeleteProvisioner(context.Context, *DeleteProvisionerRequest) (*Provisioner, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteProvisioner not implemented")
}
func (UnimplementedMajordomoServer) CreateAdministrator(context.Context, *CreateAdministratorRequest) (*Administrator, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateAdministrator not implemented")
}
func (UnimplementedMajordomoServer) DeleteAdministrator(context.Context, *DeleteAdministratorRequest) (*Administrator, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteAdministrator not implemented")
}
func (UnimplementedMajordomoServer) PostCertificate(context.Context, *CertificateRequest) (*CertificateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PostCertificate not implemented")
}
func (UnimplementedMajordomoServer) PostSSHCertificate(context.Context, *SSHCertificateRequest) (*SSHCertificateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PostSSHCertificate not implemented")
}
func (UnimplementedMajordomoServer) RevokeCertificate(context.Context, *TODO) (*TODO, error) {
return nil, status.Errorf(codes.Unimplemented, "method RevokeCertificate not implemented")
}
func (UnimplementedMajordomoServer) RevokeSSHCertificate(context.Context, *TODO) (*TODO, error) {
return nil, status.Errorf(codes.Unimplemented, "method RevokeSSHCertificate not implemented")
}
func (UnimplementedMajordomoServer) mustEmbedUnimplementedMajordomoServer() {}
// UnsafeMajordomoServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MajordomoServer will
// result in compilation errors.
type UnsafeMajordomoServer interface {
mustEmbedUnimplementedMajordomoServer()
}
func RegisterMajordomoServer(s grpc.ServiceRegistrar, srv MajordomoServer) {
s.RegisterService(&Majordomo_ServiceDesc, srv)
}
func _Majordomo_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/Login",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).Login(ctx, req.(*LoginRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_GetConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ConfigurationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).GetConfiguration(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/GetConfiguration",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).GetConfiguration(ctx, req.(*ConfigurationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_StreamConfiguration_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(ConfigurationRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(MajordomoServer).StreamConfiguration(m, &majordomoStreamConfigurationServer{stream})
}
type Majordomo_StreamConfigurationServer interface {
Send(*ConfigurationResponse) error
grpc.ServerStream
}
type majordomoStreamConfigurationServer struct {
grpc.ServerStream
}
func (x *majordomoStreamConfigurationServer) Send(m *ConfigurationResponse) error {
return x.ServerStream.SendMsg(m)
}
func _Majordomo_CreateProvisioner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateProvisionerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).CreateProvisioner(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/CreateProvisioner",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).CreateProvisioner(ctx, req.(*CreateProvisionerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_DeleteProvisioner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteProvisionerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).DeleteProvisioner(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/DeleteProvisioner",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).DeleteProvisioner(ctx, req.(*DeleteProvisionerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_CreateAdministrator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateAdministratorRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).CreateAdministrator(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/CreateAdministrator",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).CreateAdministrator(ctx, req.(*CreateAdministratorRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_DeleteAdministrator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteAdministratorRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).DeleteAdministrator(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/DeleteAdministrator",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).DeleteAdministrator(ctx, req.(*DeleteAdministratorRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_PostCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CertificateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).PostCertificate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/PostCertificate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).PostCertificate(ctx, req.(*CertificateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_PostSSHCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SSHCertificateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).PostSSHCertificate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/PostSSHCertificate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).PostSSHCertificate(ctx, req.(*SSHCertificateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_RevokeCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TODO)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).RevokeCertificate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/RevokeCertificate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).RevokeCertificate(ctx, req.(*TODO))
}
return interceptor(ctx, in, info, handler)
}
func _Majordomo_RevokeSSHCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TODO)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MajordomoServer).RevokeSSHCertificate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/majordomo.Majordomo/RevokeSSHCertificate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MajordomoServer).RevokeSSHCertificate(ctx, req.(*TODO))
}
return interceptor(ctx, in, info, handler)
}
// Majordomo_ServiceDesc is the grpc.ServiceDesc for Majordomo service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Majordomo_ServiceDesc = grpc.ServiceDesc{
ServiceName: "majordomo.Majordomo",
HandlerType: (*MajordomoServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Login",
Handler: _Majordomo_Login_Handler,
},
{
MethodName: "GetConfiguration",
Handler: _Majordomo_GetConfiguration_Handler,
},
{
MethodName: "CreateProvisioner",
Handler: _Majordomo_CreateProvisioner_Handler,
},
{
MethodName: "DeleteProvisioner",
Handler: _Majordomo_DeleteProvisioner_Handler,
},
{
MethodName: "CreateAdministrator",
Handler: _Majordomo_CreateAdministrator_Handler,
},
{
MethodName: "DeleteAdministrator",
Handler: _Majordomo_DeleteAdministrator_Handler,
},
{
MethodName: "PostCertificate",
Handler: _Majordomo_PostCertificate_Handler,
},
{
MethodName: "PostSSHCertificate",
Handler: _Majordomo_PostSSHCertificate_Handler,
},
{
MethodName: "RevokeCertificate",
Handler: _Majordomo_RevokeCertificate_Handler,
},
{
MethodName: "RevokeSSHCertificate",
Handler: _Majordomo_RevokeSSHCertificate_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "StreamConfiguration",
Handler: _Majordomo_StreamConfiguration_Handler,
ServerStreams: true,
},
},
Metadata: "majordomo/majordomo.proto",
}

File diff suppressed because it is too large Load diff

View file

@ -1,21 +1,8 @@
syntax = "proto3"; syntax = "proto3";
package majordomo; package linkedca;
option go_package = "github.com/smallstep/certificates/majordomo"; option go_package = "github.com/smallstep/certificates/linkedca";
message Administrator {
enum Type {
UNKNOWN = 0;
ADMIN = 1;
SUPER_ADMIN = 2;
}
string id = 1;
string authority_id = 2;
string subject = 3;
string provisioner_id = 4;
Type type = 5;
}
message Provisioner { message Provisioner {
enum Type { enum Type {