Phase 10: gRPC admin API with interceptor chain
Proto definitions for 4 services (RegistryService, PolicyService, AuditService, AdminService) with hand-written Go stubs using JSON codec until protobuf tooling is available. Interceptor chain: logging (method, peer IP, duration, never logs auth metadata) → auth (bearer token via MCIAS, Health bypasses) → admin (role check for GC, policy, delete, audit RPCs). All RPCs share business logic with REST handlers via internal/db and internal/gc packages. TLS 1.3 minimum on gRPC listener. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
19
gen/mcr/v1/admin.pb.go
Normal file
19
gen/mcr/v1/admin.pb.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: mcr/v1/admin.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
// HealthRequest is the request message for Health.
|
||||
type HealthRequest struct{}
|
||||
|
||||
// HealthResponse is the response message for Health.
|
||||
type HealthResponse struct {
|
||||
Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HealthResponse) GetStatus() string {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return ""
|
||||
}
|
||||
88
gen/mcr/v1/admin_grpc.pb.go
Normal file
88
gen/mcr/v1/admin_grpc.pb.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// source: mcr/v1/admin.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// AdminServiceServer is the server API for AdminService.
|
||||
type AdminServiceServer interface {
|
||||
Health(context.Context, *HealthRequest) (*HealthResponse, error)
|
||||
mustEmbedUnimplementedAdminServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedAdminServiceServer should be embedded to have forward
|
||||
// compatible implementations.
|
||||
type UnimplementedAdminServiceServer struct{}
|
||||
|
||||
func (UnimplementedAdminServiceServer) Health(context.Context, *HealthRequest) (*HealthResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Health not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedAdminServiceServer) mustEmbedUnimplementedAdminServiceServer() {}
|
||||
|
||||
// RegisterAdminServiceServer registers the AdminServiceServer with the grpc.Server.
|
||||
func RegisterAdminServiceServer(s grpc.ServiceRegistrar, srv AdminServiceServer) {
|
||||
s.RegisterService(&AdminService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func adminServiceHealthHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(HealthRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AdminServiceServer).Health(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.AdminService/Health",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(AdminServiceServer).Health(ctx, req.(*HealthRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AdminService_ServiceDesc is the grpc.ServiceDesc for AdminService.
|
||||
var AdminService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "mcr.v1.AdminService",
|
||||
HandlerType: (*AdminServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Health",
|
||||
Handler: adminServiceHealthHandler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "mcr/v1/admin.proto",
|
||||
}
|
||||
|
||||
// AdminServiceClient is the client API for AdminService.
|
||||
type AdminServiceClient interface {
|
||||
Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error)
|
||||
}
|
||||
|
||||
type adminServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
// NewAdminServiceClient creates a new AdminServiceClient.
|
||||
func NewAdminServiceClient(cc grpc.ClientConnInterface) AdminServiceClient {
|
||||
return &adminServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *adminServiceClient) Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) {
|
||||
out := new(HealthResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.AdminService/Health", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
136
gen/mcr/v1/audit.pb.go
Normal file
136
gen/mcr/v1/audit.pb.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: mcr/v1/audit.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
// AuditEvent represents an audit log entry.
|
||||
type AuditEvent struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
EventTime string `protobuf:"bytes,2,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"`
|
||||
EventType string `protobuf:"bytes,3,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"`
|
||||
ActorId string `protobuf:"bytes,4,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Repository string `protobuf:"bytes,5,opt,name=repository,proto3" json:"repository,omitempty"`
|
||||
Digest string `protobuf:"bytes,6,opt,name=digest,proto3" json:"digest,omitempty"`
|
||||
IpAddress string `protobuf:"bytes,7,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Details map[string]string `protobuf:"bytes,8,rep,name=details,proto3" json:"details,omitempty"`
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetEventTime() string {
|
||||
if x != nil {
|
||||
return x.EventTime
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetEventType() string {
|
||||
if x != nil {
|
||||
return x.EventType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetActorId() string {
|
||||
if x != nil {
|
||||
return x.ActorId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetRepository() string {
|
||||
if x != nil {
|
||||
return x.Repository
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetDigest() string {
|
||||
if x != nil {
|
||||
return x.Digest
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetIpAddress() string {
|
||||
if x != nil {
|
||||
return x.IpAddress
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuditEvent) GetDetails() map[string]string {
|
||||
if x != nil {
|
||||
return x.Details
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListAuditEventsRequest is the request message for ListAuditEvents.
|
||||
type ListAuditEventsRequest struct {
|
||||
Pagination *PaginationRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
EventType string `protobuf:"bytes,2,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"`
|
||||
ActorId string `protobuf:"bytes,3,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Repository string `protobuf:"bytes,4,opt,name=repository,proto3" json:"repository,omitempty"`
|
||||
Since string `protobuf:"bytes,5,opt,name=since,proto3" json:"since,omitempty"`
|
||||
Until string `protobuf:"bytes,6,opt,name=until,proto3" json:"until,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsRequest) GetPagination() *PaginationRequest {
|
||||
if x != nil {
|
||||
return x.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsRequest) GetEventType() string {
|
||||
if x != nil {
|
||||
return x.EventType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsRequest) GetActorId() string {
|
||||
if x != nil {
|
||||
return x.ActorId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsRequest) GetRepository() string {
|
||||
if x != nil {
|
||||
return x.Repository
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsRequest) GetSince() string {
|
||||
if x != nil {
|
||||
return x.Since
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsRequest) GetUntil() string {
|
||||
if x != nil {
|
||||
return x.Until
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ListAuditEventsResponse is the response message for ListAuditEvents.
|
||||
type ListAuditEventsResponse struct {
|
||||
Events []*AuditEvent `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListAuditEventsResponse) GetEvents() []*AuditEvent {
|
||||
if x != nil {
|
||||
return x.Events
|
||||
}
|
||||
return nil
|
||||
}
|
||||
88
gen/mcr/v1/audit_grpc.pb.go
Normal file
88
gen/mcr/v1/audit_grpc.pb.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// source: mcr/v1/audit.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// AuditServiceServer is the server API for AuditService.
|
||||
type AuditServiceServer interface {
|
||||
ListAuditEvents(context.Context, *ListAuditEventsRequest) (*ListAuditEventsResponse, error)
|
||||
mustEmbedUnimplementedAuditServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedAuditServiceServer should be embedded to have forward
|
||||
// compatible implementations.
|
||||
type UnimplementedAuditServiceServer struct{}
|
||||
|
||||
func (UnimplementedAuditServiceServer) ListAuditEvents(context.Context, *ListAuditEventsRequest) (*ListAuditEventsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListAuditEvents not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedAuditServiceServer) mustEmbedUnimplementedAuditServiceServer() {}
|
||||
|
||||
// RegisterAuditServiceServer registers the AuditServiceServer with the grpc.Server.
|
||||
func RegisterAuditServiceServer(s grpc.ServiceRegistrar, srv AuditServiceServer) {
|
||||
s.RegisterService(&AuditService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func auditServiceListAuditEventsHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(ListAuditEventsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuditServiceServer).ListAuditEvents(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.AuditService/ListAuditEvents",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(AuditServiceServer).ListAuditEvents(ctx, req.(*ListAuditEventsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AuditService_ServiceDesc is the grpc.ServiceDesc for AuditService.
|
||||
var AuditService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "mcr.v1.AuditService",
|
||||
HandlerType: (*AuditServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListAuditEvents",
|
||||
Handler: auditServiceListAuditEventsHandler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "mcr/v1/audit.proto",
|
||||
}
|
||||
|
||||
// AuditServiceClient is the client API for AuditService.
|
||||
type AuditServiceClient interface {
|
||||
ListAuditEvents(ctx context.Context, in *ListAuditEventsRequest, opts ...grpc.CallOption) (*ListAuditEventsResponse, error)
|
||||
}
|
||||
|
||||
type auditServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
// NewAuditServiceClient creates a new AuditServiceClient.
|
||||
func NewAuditServiceClient(cc grpc.ClientConnInterface) AuditServiceClient {
|
||||
return &auditServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *auditServiceClient) ListAuditEvents(ctx context.Context, in *ListAuditEventsRequest, opts ...grpc.CallOption) (*ListAuditEventsResponse, error) {
|
||||
out := new(ListAuditEventsResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.AuditService/ListAuditEvents", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
44
gen/mcr/v1/codec.go
Normal file
44
gen/mcr/v1/codec.go
Normal file
@@ -0,0 +1,44 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
//
|
||||
// This file provides a JSON codec for gRPC, used until proto tooling
|
||||
// is available to generate proper protobuf serialization code.
|
||||
|
||||
package mcrv1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc/encoding"
|
||||
"google.golang.org/grpc/mem"
|
||||
)
|
||||
|
||||
const codecName = "json"
|
||||
|
||||
func init() {
|
||||
encoding.RegisterCodecV2(JSONCodec{})
|
||||
}
|
||||
|
||||
// JSONCodec implements encoding.CodecV2 using JSON serialization.
|
||||
// It is used as a stand-in until protobuf code generation is available.
|
||||
type JSONCodec struct{}
|
||||
|
||||
func (JSONCodec) Marshal(v any) (mem.BufferSlice, error) {
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("json codec: marshal: %w", err)
|
||||
}
|
||||
return mem.BufferSlice{mem.NewBuffer(&b, nil)}, nil
|
||||
}
|
||||
|
||||
func (JSONCodec) Unmarshal(data mem.BufferSlice, v any) error {
|
||||
buf := data.Materialize()
|
||||
if err := json.Unmarshal(buf, v); err != nil {
|
||||
return fmt.Errorf("json codec: unmarshal: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (JSONCodec) Name() string {
|
||||
return codecName
|
||||
}
|
||||
24
gen/mcr/v1/common.pb.go
Normal file
24
gen/mcr/v1/common.pb.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: mcr/v1/common.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
// PaginationRequest controls pagination for list RPCs.
|
||||
type PaginationRequest struct {
|
||||
Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
Offset int32 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PaginationRequest) GetLimit() int32 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PaginationRequest) GetOffset() int32 {
|
||||
if x != nil {
|
||||
return x.Offset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
331
gen/mcr/v1/policy.pb.go
Normal file
331
gen/mcr/v1/policy.pb.go
Normal file
@@ -0,0 +1,331 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: mcr/v1/policy.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
// PolicyRule represents a policy rule.
|
||||
type PolicyRule struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Priority int32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Effect string `protobuf:"bytes,4,opt,name=effect,proto3" json:"effect,omitempty"`
|
||||
Roles []string `protobuf:"bytes,5,rep,name=roles,proto3" json:"roles,omitempty"`
|
||||
AccountTypes []string `protobuf:"bytes,6,rep,name=account_types,json=accountTypes,proto3" json:"account_types,omitempty"`
|
||||
SubjectUuid string `protobuf:"bytes,7,opt,name=subject_uuid,json=subjectUuid,proto3" json:"subject_uuid,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Actions []string `protobuf:"bytes,8,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
Repositories []string `protobuf:"bytes,9,rep,name=repositories,proto3" json:"repositories,omitempty"`
|
||||
Enabled bool `protobuf:"varint,10,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||
CreatedBy string `protobuf:"bytes,11,opt,name=created_by,json=createdBy,proto3" json:"created_by,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,12,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
UpdatedAt string `protobuf:"bytes,13,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetPriority() int32 {
|
||||
if x != nil {
|
||||
return x.Priority
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetEffect() string {
|
||||
if x != nil {
|
||||
return x.Effect
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetRoles() []string {
|
||||
if x != nil {
|
||||
return x.Roles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetAccountTypes() []string {
|
||||
if x != nil {
|
||||
return x.AccountTypes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetSubjectUuid() string {
|
||||
if x != nil {
|
||||
return x.SubjectUuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetRepositories() []string {
|
||||
if x != nil {
|
||||
return x.Repositories
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetEnabled() bool {
|
||||
if x != nil {
|
||||
return x.Enabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetCreatedBy() string {
|
||||
if x != nil {
|
||||
return x.CreatedBy
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PolicyRule) GetUpdatedAt() string {
|
||||
if x != nil {
|
||||
return x.UpdatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ListPolicyRulesRequest is the request message for ListPolicyRules.
|
||||
type ListPolicyRulesRequest struct {
|
||||
Pagination *PaginationRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListPolicyRulesRequest) GetPagination() *PaginationRequest {
|
||||
if x != nil {
|
||||
return x.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListPolicyRulesResponse is the response message for ListPolicyRules.
|
||||
type ListPolicyRulesResponse struct {
|
||||
Rules []*PolicyRule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListPolicyRulesResponse) GetRules() []*PolicyRule {
|
||||
if x != nil {
|
||||
return x.Rules
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreatePolicyRuleRequest is the request message for CreatePolicyRule.
|
||||
type CreatePolicyRuleRequest struct {
|
||||
Priority int32 `protobuf:"varint,1,opt,name=priority,proto3" json:"priority,omitempty"`
|
||||
Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Effect string `protobuf:"bytes,3,opt,name=effect,proto3" json:"effect,omitempty"`
|
||||
Roles []string `protobuf:"bytes,4,rep,name=roles,proto3" json:"roles,omitempty"`
|
||||
AccountTypes []string `protobuf:"bytes,5,rep,name=account_types,json=accountTypes,proto3" json:"account_types,omitempty"`
|
||||
SubjectUuid string `protobuf:"bytes,6,opt,name=subject_uuid,json=subjectUuid,proto3" json:"subject_uuid,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Actions []string `protobuf:"bytes,7,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
Repositories []string `protobuf:"bytes,8,rep,name=repositories,proto3" json:"repositories,omitempty"`
|
||||
Enabled bool `protobuf:"varint,9,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetPriority() int32 {
|
||||
if x != nil {
|
||||
return x.Priority
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetEffect() string {
|
||||
if x != nil {
|
||||
return x.Effect
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetRoles() []string {
|
||||
if x != nil {
|
||||
return x.Roles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetAccountTypes() []string {
|
||||
if x != nil {
|
||||
return x.AccountTypes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetSubjectUuid() string {
|
||||
if x != nil {
|
||||
return x.SubjectUuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetRepositories() []string {
|
||||
if x != nil {
|
||||
return x.Repositories
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CreatePolicyRuleRequest) GetEnabled() bool {
|
||||
if x != nil {
|
||||
return x.Enabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetPolicyRuleRequest is the request message for GetPolicyRule.
|
||||
type GetPolicyRuleRequest struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
}
|
||||
|
||||
func (x *GetPolicyRuleRequest) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// UpdatePolicyRuleRequest is the request message for UpdatePolicyRule.
|
||||
type UpdatePolicyRuleRequest struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Priority int32 `protobuf:"varint,2,opt,name=priority,proto3" json:"priority,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Effect string `protobuf:"bytes,4,opt,name=effect,proto3" json:"effect,omitempty"`
|
||||
Roles []string `protobuf:"bytes,5,rep,name=roles,proto3" json:"roles,omitempty"`
|
||||
AccountTypes []string `protobuf:"bytes,6,rep,name=account_types,json=accountTypes,proto3" json:"account_types,omitempty"`
|
||||
SubjectUuid string `protobuf:"bytes,7,opt,name=subject_uuid,json=subjectUuid,proto3" json:"subject_uuid,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
Actions []string `protobuf:"bytes,8,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
Repositories []string `protobuf:"bytes,9,rep,name=repositories,proto3" json:"repositories,omitempty"`
|
||||
Enabled bool `protobuf:"varint,10,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||
UpdateMask []string `protobuf:"bytes,11,rep,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetPriority() int32 {
|
||||
if x != nil {
|
||||
return x.Priority
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetEffect() string {
|
||||
if x != nil {
|
||||
return x.Effect
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetRoles() []string {
|
||||
if x != nil {
|
||||
return x.Roles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetAccountTypes() []string {
|
||||
if x != nil {
|
||||
return x.AccountTypes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetSubjectUuid() string {
|
||||
if x != nil {
|
||||
return x.SubjectUuid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetRepositories() []string {
|
||||
if x != nil {
|
||||
return x.Repositories
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetEnabled() bool {
|
||||
if x != nil {
|
||||
return x.Enabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *UpdatePolicyRuleRequest) GetUpdateMask() []string {
|
||||
if x != nil {
|
||||
return x.UpdateMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeletePolicyRuleRequest is the request message for DeletePolicyRule.
|
||||
type DeletePolicyRuleRequest struct {
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
}
|
||||
|
||||
func (x *DeletePolicyRuleRequest) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// DeletePolicyRuleResponse is the response message for DeletePolicyRule.
|
||||
type DeletePolicyRuleResponse struct{}
|
||||
236
gen/mcr/v1/policy_grpc.pb.go
Normal file
236
gen/mcr/v1/policy_grpc.pb.go
Normal file
@@ -0,0 +1,236 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// source: mcr/v1/policy.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// PolicyServiceServer is the server API for PolicyService.
|
||||
type PolicyServiceServer interface {
|
||||
ListPolicyRules(context.Context, *ListPolicyRulesRequest) (*ListPolicyRulesResponse, error)
|
||||
CreatePolicyRule(context.Context, *CreatePolicyRuleRequest) (*PolicyRule, error)
|
||||
GetPolicyRule(context.Context, *GetPolicyRuleRequest) (*PolicyRule, error)
|
||||
UpdatePolicyRule(context.Context, *UpdatePolicyRuleRequest) (*PolicyRule, error)
|
||||
DeletePolicyRule(context.Context, *DeletePolicyRuleRequest) (*DeletePolicyRuleResponse, error)
|
||||
mustEmbedUnimplementedPolicyServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedPolicyServiceServer should be embedded to have forward
|
||||
// compatible implementations.
|
||||
type UnimplementedPolicyServiceServer struct{}
|
||||
|
||||
func (UnimplementedPolicyServiceServer) ListPolicyRules(context.Context, *ListPolicyRulesRequest) (*ListPolicyRulesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListPolicyRules not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedPolicyServiceServer) CreatePolicyRule(context.Context, *CreatePolicyRuleRequest) (*PolicyRule, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreatePolicyRule not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedPolicyServiceServer) GetPolicyRule(context.Context, *GetPolicyRuleRequest) (*PolicyRule, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetPolicyRule not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedPolicyServiceServer) UpdatePolicyRule(context.Context, *UpdatePolicyRuleRequest) (*PolicyRule, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdatePolicyRule not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedPolicyServiceServer) DeletePolicyRule(context.Context, *DeletePolicyRuleRequest) (*DeletePolicyRuleResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeletePolicyRule not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedPolicyServiceServer) mustEmbedUnimplementedPolicyServiceServer() {}
|
||||
|
||||
// RegisterPolicyServiceServer registers the PolicyServiceServer with the grpc.Server.
|
||||
func RegisterPolicyServiceServer(s grpc.ServiceRegistrar, srv PolicyServiceServer) {
|
||||
s.RegisterService(&PolicyService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func policyServiceListPolicyRulesHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(ListPolicyRulesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PolicyServiceServer).ListPolicyRules(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.PolicyService/ListPolicyRules",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(PolicyServiceServer).ListPolicyRules(ctx, req.(*ListPolicyRulesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func policyServiceCreatePolicyRuleHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(CreatePolicyRuleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PolicyServiceServer).CreatePolicyRule(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.PolicyService/CreatePolicyRule",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(PolicyServiceServer).CreatePolicyRule(ctx, req.(*CreatePolicyRuleRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func policyServiceGetPolicyRuleHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(GetPolicyRuleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PolicyServiceServer).GetPolicyRule(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.PolicyService/GetPolicyRule",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(PolicyServiceServer).GetPolicyRule(ctx, req.(*GetPolicyRuleRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func policyServiceUpdatePolicyRuleHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(UpdatePolicyRuleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PolicyServiceServer).UpdatePolicyRule(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.PolicyService/UpdatePolicyRule",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(PolicyServiceServer).UpdatePolicyRule(ctx, req.(*UpdatePolicyRuleRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func policyServiceDeletePolicyRuleHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(DeletePolicyRuleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(PolicyServiceServer).DeletePolicyRule(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.PolicyService/DeletePolicyRule",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(PolicyServiceServer).DeletePolicyRule(ctx, req.(*DeletePolicyRuleRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// PolicyService_ServiceDesc is the grpc.ServiceDesc for PolicyService.
|
||||
var PolicyService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "mcr.v1.PolicyService",
|
||||
HandlerType: (*PolicyServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListPolicyRules",
|
||||
Handler: policyServiceListPolicyRulesHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreatePolicyRule",
|
||||
Handler: policyServiceCreatePolicyRuleHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetPolicyRule",
|
||||
Handler: policyServiceGetPolicyRuleHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpdatePolicyRule",
|
||||
Handler: policyServiceUpdatePolicyRuleHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeletePolicyRule",
|
||||
Handler: policyServiceDeletePolicyRuleHandler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "mcr/v1/policy.proto",
|
||||
}
|
||||
|
||||
// PolicyServiceClient is the client API for PolicyService.
|
||||
type PolicyServiceClient interface {
|
||||
ListPolicyRules(ctx context.Context, in *ListPolicyRulesRequest, opts ...grpc.CallOption) (*ListPolicyRulesResponse, error)
|
||||
CreatePolicyRule(ctx context.Context, in *CreatePolicyRuleRequest, opts ...grpc.CallOption) (*PolicyRule, error)
|
||||
GetPolicyRule(ctx context.Context, in *GetPolicyRuleRequest, opts ...grpc.CallOption) (*PolicyRule, error)
|
||||
UpdatePolicyRule(ctx context.Context, in *UpdatePolicyRuleRequest, opts ...grpc.CallOption) (*PolicyRule, error)
|
||||
DeletePolicyRule(ctx context.Context, in *DeletePolicyRuleRequest, opts ...grpc.CallOption) (*DeletePolicyRuleResponse, error)
|
||||
}
|
||||
|
||||
type policyServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
// NewPolicyServiceClient creates a new PolicyServiceClient.
|
||||
func NewPolicyServiceClient(cc grpc.ClientConnInterface) PolicyServiceClient {
|
||||
return &policyServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *policyServiceClient) ListPolicyRules(ctx context.Context, in *ListPolicyRulesRequest, opts ...grpc.CallOption) (*ListPolicyRulesResponse, error) {
|
||||
out := new(ListPolicyRulesResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.PolicyService/ListPolicyRules", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *policyServiceClient) CreatePolicyRule(ctx context.Context, in *CreatePolicyRuleRequest, opts ...grpc.CallOption) (*PolicyRule, error) {
|
||||
out := new(PolicyRule)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.PolicyService/CreatePolicyRule", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *policyServiceClient) GetPolicyRule(ctx context.Context, in *GetPolicyRuleRequest, opts ...grpc.CallOption) (*PolicyRule, error) {
|
||||
out := new(PolicyRule)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.PolicyService/GetPolicyRule", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *policyServiceClient) UpdatePolicyRule(ctx context.Context, in *UpdatePolicyRuleRequest, opts ...grpc.CallOption) (*PolicyRule, error) {
|
||||
out := new(PolicyRule)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.PolicyService/UpdatePolicyRule", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *policyServiceClient) DeletePolicyRule(ctx context.Context, in *DeletePolicyRuleRequest, opts ...grpc.CallOption) (*DeletePolicyRuleResponse, error) {
|
||||
out := new(DeletePolicyRuleResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.PolicyService/DeletePolicyRule", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
273
gen/mcr/v1/registry.pb.go
Normal file
273
gen/mcr/v1/registry.pb.go
Normal file
@@ -0,0 +1,273 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: mcr/v1/registry.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
// RepositoryMetadata is a repository summary for listing.
|
||||
type RepositoryMetadata struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
TagCount int32 `protobuf:"varint,2,opt,name=tag_count,json=tagCount,proto3" json:"tag_count,omitempty"`
|
||||
ManifestCount int32 `protobuf:"varint,3,opt,name=manifest_count,json=manifestCount,proto3" json:"manifest_count,omitempty"`
|
||||
TotalSize int64 `protobuf:"varint,4,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RepositoryMetadata) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RepositoryMetadata) GetTagCount() int32 {
|
||||
if x != nil {
|
||||
return x.TagCount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RepositoryMetadata) GetManifestCount() int32 {
|
||||
if x != nil {
|
||||
return x.ManifestCount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RepositoryMetadata) GetTotalSize() int64 {
|
||||
if x != nil {
|
||||
return x.TotalSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RepositoryMetadata) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// TagInfo is a tag with its manifest digest.
|
||||
type TagInfo struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Digest string `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TagInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TagInfo) GetDigest() string {
|
||||
if x != nil {
|
||||
return x.Digest
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ManifestInfo is a manifest summary.
|
||||
type ManifestInfo struct {
|
||||
Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"`
|
||||
MediaType string `protobuf:"bytes,2,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
|
||||
Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ManifestInfo) GetDigest() string {
|
||||
if x != nil {
|
||||
return x.Digest
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestInfo) GetMediaType() string {
|
||||
if x != nil {
|
||||
return x.MediaType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ManifestInfo) GetSize() int64 {
|
||||
if x != nil {
|
||||
return x.Size
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ManifestInfo) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ListRepositoriesRequest is the request message for ListRepositories.
|
||||
type ListRepositoriesRequest struct {
|
||||
Pagination *PaginationRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListRepositoriesRequest) GetPagination() *PaginationRequest {
|
||||
if x != nil {
|
||||
return x.Pagination
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListRepositoriesResponse is the response message for ListRepositories.
|
||||
type ListRepositoriesResponse struct {
|
||||
Repositories []*RepositoryMetadata `protobuf:"bytes,1,rep,name=repositories,proto3" json:"repositories,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListRepositoriesResponse) GetRepositories() []*RepositoryMetadata {
|
||||
if x != nil {
|
||||
return x.Repositories
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRepositoryRequest is the request message for GetRepository.
|
||||
type GetRepositoryRequest struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRepositoryRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetRepositoryResponse is the response message for GetRepository.
|
||||
type GetRepositoryResponse struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Tags []*TagInfo `protobuf:"bytes,2,rep,name=tags,proto3" json:"tags,omitempty"`
|
||||
Manifests []*ManifestInfo `protobuf:"bytes,3,rep,name=manifests,proto3" json:"manifests,omitempty"`
|
||||
TotalSize int64 `protobuf:"varint,4,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"`
|
||||
CreatedAt string `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetRepositoryResponse) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetRepositoryResponse) GetTags() []*TagInfo {
|
||||
if x != nil {
|
||||
return x.Tags
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetRepositoryResponse) GetManifests() []*ManifestInfo {
|
||||
if x != nil {
|
||||
return x.Manifests
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetRepositoryResponse) GetTotalSize() int64 {
|
||||
if x != nil {
|
||||
return x.TotalSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetRepositoryResponse) GetCreatedAt() string {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// DeleteRepositoryRequest is the request message for DeleteRepository.
|
||||
type DeleteRepositoryRequest struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteRepositoryRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// DeleteRepositoryResponse is the response message for DeleteRepository.
|
||||
type DeleteRepositoryResponse struct{}
|
||||
|
||||
// GarbageCollectRequest is the request message for GarbageCollect.
|
||||
type GarbageCollectRequest struct{}
|
||||
|
||||
// GarbageCollectResponse is the response message for GarbageCollect.
|
||||
type GarbageCollectResponse struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //nolint:revive,stylecheck // proto field name
|
||||
}
|
||||
|
||||
func (x *GarbageCollectResponse) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetGCStatusRequest is the request message for GetGCStatus.
|
||||
type GetGCStatusRequest struct{}
|
||||
|
||||
// GCLastRun records the result of the last garbage collection run.
|
||||
type GCLastRun struct {
|
||||
StartedAt string `protobuf:"bytes,1,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
|
||||
CompletedAt string `protobuf:"bytes,2,opt,name=completed_at,json=completedAt,proto3" json:"completed_at,omitempty"`
|
||||
BlobsRemoved int32 `protobuf:"varint,3,opt,name=blobs_removed,json=blobsRemoved,proto3" json:"blobs_removed,omitempty"`
|
||||
BytesFreed int64 `protobuf:"varint,4,opt,name=bytes_freed,json=bytesFreed,proto3" json:"bytes_freed,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GCLastRun) GetStartedAt() string {
|
||||
if x != nil {
|
||||
return x.StartedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GCLastRun) GetCompletedAt() string {
|
||||
if x != nil {
|
||||
return x.CompletedAt
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GCLastRun) GetBlobsRemoved() int32 {
|
||||
if x != nil {
|
||||
return x.BlobsRemoved
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GCLastRun) GetBytesFreed() int64 {
|
||||
if x != nil {
|
||||
return x.BytesFreed
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// GetGCStatusResponse is the response message for GetGCStatus.
|
||||
type GetGCStatusResponse struct {
|
||||
Running bool `protobuf:"varint,1,opt,name=running,proto3" json:"running,omitempty"`
|
||||
LastRun *GCLastRun `protobuf:"bytes,2,opt,name=last_run,json=lastRun,proto3" json:"last_run,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetGCStatusResponse) GetRunning() bool {
|
||||
if x != nil {
|
||||
return x.Running
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *GetGCStatusResponse) GetLastRun() *GCLastRun {
|
||||
if x != nil {
|
||||
return x.LastRun
|
||||
}
|
||||
return nil
|
||||
}
|
||||
236
gen/mcr/v1/registry_grpc.pb.go
Normal file
236
gen/mcr/v1/registry_grpc.pb.go
Normal file
@@ -0,0 +1,236 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// source: mcr/v1/registry.proto
|
||||
|
||||
package mcrv1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// RegistryServiceServer is the server API for RegistryService.
|
||||
type RegistryServiceServer interface {
|
||||
ListRepositories(context.Context, *ListRepositoriesRequest) (*ListRepositoriesResponse, error)
|
||||
GetRepository(context.Context, *GetRepositoryRequest) (*GetRepositoryResponse, error)
|
||||
DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error)
|
||||
GarbageCollect(context.Context, *GarbageCollectRequest) (*GarbageCollectResponse, error)
|
||||
GetGCStatus(context.Context, *GetGCStatusRequest) (*GetGCStatusResponse, error)
|
||||
mustEmbedUnimplementedRegistryServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedRegistryServiceServer should be embedded to have forward
|
||||
// compatible implementations.
|
||||
type UnimplementedRegistryServiceServer struct{}
|
||||
|
||||
func (UnimplementedRegistryServiceServer) ListRepositories(context.Context, *ListRepositoriesRequest) (*ListRepositoriesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListRepositories not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedRegistryServiceServer) GetRepository(context.Context, *GetRepositoryRequest) (*GetRepositoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRepository not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedRegistryServiceServer) DeleteRepository(context.Context, *DeleteRepositoryRequest) (*DeleteRepositoryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteRepository not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedRegistryServiceServer) GarbageCollect(context.Context, *GarbageCollectRequest) (*GarbageCollectResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GarbageCollect not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedRegistryServiceServer) GetGCStatus(context.Context, *GetGCStatusRequest) (*GetGCStatusResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetGCStatus not implemented")
|
||||
}
|
||||
|
||||
func (UnimplementedRegistryServiceServer) mustEmbedUnimplementedRegistryServiceServer() {}
|
||||
|
||||
// RegisterRegistryServiceServer registers the RegistryServiceServer with the grpc.Server.
|
||||
func RegisterRegistryServiceServer(s grpc.ServiceRegistrar, srv RegistryServiceServer) {
|
||||
s.RegisterService(&RegistryService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func registryServiceListRepositoriesHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(ListRepositoriesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RegistryServiceServer).ListRepositories(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.RegistryService/ListRepositories",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(RegistryServiceServer).ListRepositories(ctx, req.(*ListRepositoriesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func registryServiceGetRepositoryHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(GetRepositoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RegistryServiceServer).GetRepository(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.RegistryService/GetRepository",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(RegistryServiceServer).GetRepository(ctx, req.(*GetRepositoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func registryServiceDeleteRepositoryHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(DeleteRepositoryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RegistryServiceServer).DeleteRepository(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.RegistryService/DeleteRepository",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(RegistryServiceServer).DeleteRepository(ctx, req.(*DeleteRepositoryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func registryServiceGarbageCollectHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(GarbageCollectRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RegistryServiceServer).GarbageCollect(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.RegistryService/GarbageCollect",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(RegistryServiceServer).GarbageCollect(ctx, req.(*GarbageCollectRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func registryServiceGetGCStatusHandler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(GetGCStatusRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RegistryServiceServer).GetGCStatus(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/mcr.v1.RegistryService/GetGCStatus",
|
||||
}
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(RegistryServiceServer).GetGCStatus(ctx, req.(*GetGCStatusRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// RegistryService_ServiceDesc is the grpc.ServiceDesc for RegistryService.
|
||||
var RegistryService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "mcr.v1.RegistryService",
|
||||
HandlerType: (*RegistryServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListRepositories",
|
||||
Handler: registryServiceListRepositoriesHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRepository",
|
||||
Handler: registryServiceGetRepositoryHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteRepository",
|
||||
Handler: registryServiceDeleteRepositoryHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "GarbageCollect",
|
||||
Handler: registryServiceGarbageCollectHandler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetGCStatus",
|
||||
Handler: registryServiceGetGCStatusHandler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "mcr/v1/registry.proto",
|
||||
}
|
||||
|
||||
// RegistryServiceClient is the client API for RegistryService.
|
||||
type RegistryServiceClient interface {
|
||||
ListRepositories(ctx context.Context, in *ListRepositoriesRequest, opts ...grpc.CallOption) (*ListRepositoriesResponse, error)
|
||||
GetRepository(ctx context.Context, in *GetRepositoryRequest, opts ...grpc.CallOption) (*GetRepositoryResponse, error)
|
||||
DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error)
|
||||
GarbageCollect(ctx context.Context, in *GarbageCollectRequest, opts ...grpc.CallOption) (*GarbageCollectResponse, error)
|
||||
GetGCStatus(ctx context.Context, in *GetGCStatusRequest, opts ...grpc.CallOption) (*GetGCStatusResponse, error)
|
||||
}
|
||||
|
||||
type registryServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
// NewRegistryServiceClient creates a new RegistryServiceClient.
|
||||
func NewRegistryServiceClient(cc grpc.ClientConnInterface) RegistryServiceClient {
|
||||
return ®istryServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *registryServiceClient) ListRepositories(ctx context.Context, in *ListRepositoriesRequest, opts ...grpc.CallOption) (*ListRepositoriesResponse, error) {
|
||||
out := new(ListRepositoriesResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.RegistryService/ListRepositories", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *registryServiceClient) GetRepository(ctx context.Context, in *GetRepositoryRequest, opts ...grpc.CallOption) (*GetRepositoryResponse, error) {
|
||||
out := new(GetRepositoryResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.RegistryService/GetRepository", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *registryServiceClient) DeleteRepository(ctx context.Context, in *DeleteRepositoryRequest, opts ...grpc.CallOption) (*DeleteRepositoryResponse, error) {
|
||||
out := new(DeleteRepositoryResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.RegistryService/DeleteRepository", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *registryServiceClient) GarbageCollect(ctx context.Context, in *GarbageCollectRequest, opts ...grpc.CallOption) (*GarbageCollectResponse, error) {
|
||||
out := new(GarbageCollectResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.RegistryService/GarbageCollect", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *registryServiceClient) GetGCStatus(ctx context.Context, in *GetGCStatusRequest, opts ...grpc.CallOption) (*GetGCStatusResponse, error) {
|
||||
out := new(GetGCStatusResponse)
|
||||
err := c.cc.Invoke(ctx, "/mcr.v1.RegistryService/GetGCStatus", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
Reference in New Issue
Block a user