feat(proto): define agent service v1 and generate Go code with buf

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
beug.k@beugsiud.de
2026-10-12 18:59:12 +02:00
co-authored by Claude Opus 5.5
parent 14dde4bfe4
commit 850858642b
6 changed files with 2929 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: Apache-2.0
# Remote plugins are pinned; keep their versions in step with
# google.golang.org/protobuf and google.golang.org/grpc in go.mod.
version: v2
plugins:
- remote: buf.build/protocolbuffers/go:v1.36.12
out: proto/gen
opt: paths=source_relative
- remote: buf.build/grpc/go:v1.6.2
out: proto/gen
opt: paths=source_relative
inputs:
- directory: proto
+10
View File
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: Apache-2.0
version: v2
modules:
- path: proto
lint:
use:
- STANDARD
breaking:
use:
- FILE
+1
View File
@@ -6,6 +6,7 @@
## Entscheidung
- Protokoll **gRPC** (Protobuf-Definitionen unter `proto/ddi/agent/v1`, Lint und Generierung mit `buf`). Generierter Go-Code wird eingecheckt, damit der Build ohne `buf` funktioniert; die CI prüft, dass er aktuell ist.
- Die Generatoren laufen als **versionsgepinnte buf-Remote-Plugins** (`buf.build/protocolbuffers/go`, `buf.build/grpc/go`), deren Versionen mit `google.golang.org/protobuf` bzw. `google.golang.org/grpc` in `go.mod` übereinstimmen. Damit braucht die Generierung keine lokal gebauten Plugin-Binaries (auf verwalteten Windows-Arbeitsplätzen blockieren Sicherheitsrichtlinien diese teilweise), und die Ergebnisse sind lokal und in der CI identisch. Voraussetzung ist Netzzugriff auf `buf.build` zur Generierungszeit, nicht zur Build-Zeit.
- Der Agent verbindet sich **immer ausgehend** zum Server (eigener Port, Standard `8444/tcp`, getrennt von Web-UI/API auf `8443/tcp`).
- Transport: **TLS 1.3** mit Client-Zertifikat (mTLS). Ausnahme ist nur der Enrollment-Aufruf, der ein einmaliges Token statt eines Zertifikats nutzt (siehe [0008](0008-interne-ca-enrollment.md)). Der Listener nutzt `VerifyClientCertIfGiven`; ein Interceptor erzwingt das Zertifikat für alle anderen Methoden.
- **Bidirektionaler Stream** `Connect`: Der Agent meldet Health und Status, der Server sendet Kommandos (`apply revision N`, `renew certificate`, …). Keepalives erkennen tote Verbindungen.
+279
View File
@@ -0,0 +1,279 @@
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package ddi.agent.v1;
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
option go_package = "git.beugsiud.de/beug.k/DDI/proto/gen/ddi/agent/v1;agentv1";
// AgentService is implemented by the management server and called by agents.
// Agents always connect outbound (docs/adr/0007-server-agent-grpc-mtls.md).
// Every RPC except Enroll requires a client certificate issued by the
// server's internal CA (docs/adr/0008-interne-ca-enrollment.md).
service AgentService {
// Enroll exchanges a one-time token and a certificate signing request for a
// client certificate. It is the only RPC allowed without client certificate.
rpc Enroll(EnrollRequest) returns (EnrollResponse);
// RenewCertificate issues a new client certificate for a freshly generated
// key. Allowed with a certificate that expired at most 30 days ago.
rpc RenewCertificate(RenewCertificateRequest) returns (RenewCertificateResponse);
// Connect is the long-lived control stream. The agent sends Hello first,
// then heartbeats and command acknowledgements; the server answers with
// Welcome and pushes commands.
rpc Connect(stream ConnectRequest) returns (stream ConnectResponse);
// GetDesiredState returns the revision the agent should run. Used for
// auto_pull and as fallback when the Connect stream is unavailable.
rpc GetDesiredState(GetDesiredStateRequest) returns (GetDesiredStateResponse);
// FetchBundle downloads the signed configuration bundle of a revision
// (docs/adr/0009-signierte-config-bundles.md).
rpc FetchBundle(FetchBundleRequest) returns (FetchBundleResponse);
// ReportDeployment reports the outcome of applying a revision.
rpc ReportDeployment(ReportDeploymentRequest) returns (ReportDeploymentResponse);
// ReportLeases sends a batch of DHCP lease observations (DHCP agents only).
rpc ReportLeases(ReportLeasesRequest) returns (ReportLeasesResponse);
}
// Role of an agent.
enum Role {
ROLE_UNSPECIFIED = 0;
ROLE_DNS = 1;
ROLE_DHCP = 2;
}
// OperatingMode controls when an agent applies new revisions.
enum OperatingMode {
OPERATING_MODE_UNSPECIFIED = 0;
// The agent applies new revisions on its own within the pull interval.
OPERATING_MODE_AUTO_PULL = 1;
// The agent applies revisions only when told to (push from the UI).
OPERATING_MODE_MANUAL = 2;
}
// HealthState summarises the state of the managed service.
enum HealthState {
HEALTH_STATE_UNSPECIFIED = 0;
HEALTH_STATE_OK = 1;
HEALTH_STATE_DEGRADED = 2;
HEALTH_STATE_FAILED = 3;
}
message EnrollRequest {
// One-time enrollment token in the form "<id>.<secret>".
string token = 1;
// PKCS#10 certificate signing request, DER encoded. The private key never
// leaves the agent.
bytes csr_der = 2;
Role role = 3;
string hostname = 4;
string agent_version = 5;
}
message EnrollResponse {
// Agent identifier assigned by the server (UUID).
string agent_id = 1;
// Issued client certificate, DER encoded.
bytes certificate_der = 2;
// CA chain, DER encoded, root last.
repeated bytes ca_certificates_der = 3;
// Ed25519 public key that verifies configuration bundles.
bytes bundle_signing_public_key = 4;
}
message RenewCertificateRequest {
bytes csr_der = 1;
}
message RenewCertificateResponse {
bytes certificate_der = 1;
repeated bytes ca_certificates_der = 2;
}
message ConnectRequest {
oneof message {
Hello hello = 1;
Heartbeat heartbeat = 2;
CommandAck command_ack = 3;
}
}
message ConnectResponse {
oneof message {
Welcome welcome = 1;
Command command = 2;
}
}
// Hello is the first message an agent sends on a new stream.
message Hello {
string agent_version = 1;
// Revision currently active on the agent (0 = none).
uint64 applied_revision = 2;
// Last revision that passed its health check.
uint64 last_good_revision = 3;
HealthStatus health = 4;
// Version of the managed service, e.g. "BIND 9.20.3" or "Kea 3.2.1".
string service_version = 5;
}
message Heartbeat {
uint64 applied_revision = 1;
HealthStatus health = 2;
}
message HealthStatus {
HealthState state = 1;
string message = 2;
google.protobuf.Timestamp checked_at = 3;
repeated HealthCheck checks = 4;
}
message HealthCheck {
string name = 1;
HealthState state = 2;
string message = 3;
}
// Welcome tells the agent its current settings.
message Welcome {
OperatingMode mode = 1;
google.protobuf.Duration pull_interval = 2;
google.protobuf.Duration heartbeat_interval = 3;
}
// Command is pushed by the server over the Connect stream.
message Command {
// Unique ID, echoed in CommandAck.
string command_id = 1;
oneof action {
ApplyRevisionCommand apply_revision = 10;
RenewCertificateCommand renew_certificate = 11;
}
}
// ApplyRevisionCommand asks the agent to fetch and apply a revision now.
message ApplyRevisionCommand {
uint64 revision = 1;
// Correlates server, agent logs and the deployment record.
string deployment_id = 2;
}
// RenewCertificateCommand asks the agent to renew its certificate now.
message RenewCertificateCommand {}
// CommandAck confirms receipt of a command. The outcome of an apply is
// reported separately via ReportDeployment.
message CommandAck {
string command_id = 1;
bool accepted = 2;
// Reason if not accepted (e.g. "maintenance window closed").
string message = 3;
}
message GetDesiredStateRequest {
uint64 applied_revision = 1;
}
message GetDesiredStateResponse {
// Revision the agent should run. 0 means no configuration assigned yet.
uint64 desired_revision = 1;
OperatingMode mode = 2;
google.protobuf.Duration pull_interval = 3;
}
message FetchBundleRequest {
uint64 revision = 1;
}
message FetchBundleResponse {
// Manifest bytes exactly as signed (JSON). Verify before parsing.
bytes manifest = 1;
// Ed25519 signature over manifest.
bytes signature = 2;
// Artifact contents; paths, modes and SHA-256 sums are in the manifest.
repeated Artifact artifacts = 3;
}
message Artifact {
string path = 1;
bytes content = 2;
}
// DeploymentTrigger says why an agent applied a revision.
enum DeploymentTrigger {
DEPLOYMENT_TRIGGER_UNSPECIFIED = 0;
DEPLOYMENT_TRIGGER_PULL = 1;
DEPLOYMENT_TRIGGER_PUSH = 2;
}
// DeploymentOutcome is the result of applying a revision.
enum DeploymentOutcome {
DEPLOYMENT_OUTCOME_UNSPECIFIED = 0;
// Validated, activated and healthy.
DEPLOYMENT_OUTCOME_SUCCEEDED = 1;
// Signature or syntax check failed; nothing was changed.
DEPLOYMENT_OUTCOME_REJECTED = 2;
// Activated but unhealthy; the previous revision was restored.
DEPLOYMENT_OUTCOME_ROLLED_BACK = 3;
// Activated, unhealthy and the rollback failed as well.
DEPLOYMENT_OUTCOME_FAILED = 4;
}
message ReportDeploymentRequest {
// Empty for pulls the server did not initiate.
string deployment_id = 1;
uint64 revision = 2;
DeploymentTrigger trigger = 3;
DeploymentOutcome outcome = 4;
// Human-readable details (English), e.g. checker output.
string message = 5;
// Revision active after this deployment.
uint64 active_revision = 6;
google.protobuf.Timestamp started_at = 7;
google.protobuf.Timestamp finished_at = 8;
}
message ReportDeploymentResponse {}
// LeaseState mirrors the Kea lease states relevant for address tracking.
enum LeaseState {
LEASE_STATE_UNSPECIFIED = 0;
LEASE_STATE_ACTIVE = 1;
LEASE_STATE_EXPIRED = 2;
LEASE_STATE_RELEASED = 3;
LEASE_STATE_DECLINED = 4;
}
message Lease {
// IPv4 or IPv6 address in text form.
string ip = 1;
// Hardware address, lowercase colon-separated.
string mac = 2;
string hostname = 3;
LeaseState state = 4;
google.protobuf.Timestamp expires_at = 5;
google.protobuf.Timestamp updated_at = 6;
// Kea subnet ID as rendered by the configuration generator.
uint32 subnet_id = 7;
string client_id = 8;
}
message ReportLeasesRequest {
// Monotonic per agent; lets the server drop duplicate batches.
uint64 sequence = 1;
// True if this batch is a full snapshot rather than a set of changes.
bool full_sync = 2;
repeated Lease leases = 3;
}
message ReportLeasesResponse {
uint64 acknowledged_sequence = 1;
}
+2244
View File
File diff suppressed because it is too large Load Diff
+382
View File
@@ -0,0 +1,382 @@
// SPDX-License-Identifier: Apache-2.0
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// source: ddi/agent/v1/agent.proto
package agentv1
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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
AgentService_Enroll_FullMethodName = "/ddi.agent.v1.AgentService/Enroll"
AgentService_RenewCertificate_FullMethodName = "/ddi.agent.v1.AgentService/RenewCertificate"
AgentService_Connect_FullMethodName = "/ddi.agent.v1.AgentService/Connect"
AgentService_GetDesiredState_FullMethodName = "/ddi.agent.v1.AgentService/GetDesiredState"
AgentService_FetchBundle_FullMethodName = "/ddi.agent.v1.AgentService/FetchBundle"
AgentService_ReportDeployment_FullMethodName = "/ddi.agent.v1.AgentService/ReportDeployment"
AgentService_ReportLeases_FullMethodName = "/ddi.agent.v1.AgentService/ReportLeases"
)
// AgentServiceClient is the client API for AgentService 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.
//
// AgentService is implemented by the management server and called by agents.
// Agents always connect outbound (docs/adr/0007-server-agent-grpc-mtls.md).
// Every RPC except Enroll requires a client certificate issued by the
// server's internal CA (docs/adr/0008-interne-ca-enrollment.md).
type AgentServiceClient interface {
// Enroll exchanges a one-time token and a certificate signing request for a
// client certificate. It is the only RPC allowed without client certificate.
Enroll(ctx context.Context, in *EnrollRequest, opts ...grpc.CallOption) (*EnrollResponse, error)
// RenewCertificate issues a new client certificate for a freshly generated
// key. Allowed with a certificate that expired at most 30 days ago.
RenewCertificate(ctx context.Context, in *RenewCertificateRequest, opts ...grpc.CallOption) (*RenewCertificateResponse, error)
// Connect is the long-lived control stream. The agent sends Hello first,
// then heartbeats and command acknowledgements; the server answers with
// Welcome and pushes commands.
Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ConnectRequest, ConnectResponse], error)
// GetDesiredState returns the revision the agent should run. Used for
// auto_pull and as fallback when the Connect stream is unavailable.
GetDesiredState(ctx context.Context, in *GetDesiredStateRequest, opts ...grpc.CallOption) (*GetDesiredStateResponse, error)
// FetchBundle downloads the signed configuration bundle of a revision
// (docs/adr/0009-signierte-config-bundles.md).
FetchBundle(ctx context.Context, in *FetchBundleRequest, opts ...grpc.CallOption) (*FetchBundleResponse, error)
// ReportDeployment reports the outcome of applying a revision.
ReportDeployment(ctx context.Context, in *ReportDeploymentRequest, opts ...grpc.CallOption) (*ReportDeploymentResponse, error)
// ReportLeases sends a batch of DHCP lease observations (DHCP agents only).
ReportLeases(ctx context.Context, in *ReportLeasesRequest, opts ...grpc.CallOption) (*ReportLeasesResponse, error)
}
type agentServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAgentServiceClient(cc grpc.ClientConnInterface) AgentServiceClient {
return &agentServiceClient{cc}
}
func (c *agentServiceClient) Enroll(ctx context.Context, in *EnrollRequest, opts ...grpc.CallOption) (*EnrollResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(EnrollResponse)
err := c.cc.Invoke(ctx, AgentService_Enroll_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) RenewCertificate(ctx context.Context, in *RenewCertificateRequest, opts ...grpc.CallOption) (*RenewCertificateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RenewCertificateResponse)
err := c.cc.Invoke(ctx, AgentService_RenewCertificate_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ConnectRequest, ConnectResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &AgentService_ServiceDesc.Streams[0], AgentService_Connect_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
x := &grpc.GenericClientStream[ConnectRequest, ConnectResponse]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type AgentService_ConnectClient = grpc.BidiStreamingClient[ConnectRequest, ConnectResponse]
func (c *agentServiceClient) GetDesiredState(ctx context.Context, in *GetDesiredStateRequest, opts ...grpc.CallOption) (*GetDesiredStateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetDesiredStateResponse)
err := c.cc.Invoke(ctx, AgentService_GetDesiredState_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) FetchBundle(ctx context.Context, in *FetchBundleRequest, opts ...grpc.CallOption) (*FetchBundleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(FetchBundleResponse)
err := c.cc.Invoke(ctx, AgentService_FetchBundle_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) ReportDeployment(ctx context.Context, in *ReportDeploymentRequest, opts ...grpc.CallOption) (*ReportDeploymentResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReportDeploymentResponse)
err := c.cc.Invoke(ctx, AgentService_ReportDeployment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) ReportLeases(ctx context.Context, in *ReportLeasesRequest, opts ...grpc.CallOption) (*ReportLeasesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ReportLeasesResponse)
err := c.cc.Invoke(ctx, AgentService_ReportLeases_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentServiceServer is the server API for AgentService service.
// All implementations must embed UnimplementedAgentServiceServer
// for forward compatibility.
//
// AgentService is implemented by the management server and called by agents.
// Agents always connect outbound (docs/adr/0007-server-agent-grpc-mtls.md).
// Every RPC except Enroll requires a client certificate issued by the
// server's internal CA (docs/adr/0008-interne-ca-enrollment.md).
type AgentServiceServer interface {
// Enroll exchanges a one-time token and a certificate signing request for a
// client certificate. It is the only RPC allowed without client certificate.
Enroll(context.Context, *EnrollRequest) (*EnrollResponse, error)
// RenewCertificate issues a new client certificate for a freshly generated
// key. Allowed with a certificate that expired at most 30 days ago.
RenewCertificate(context.Context, *RenewCertificateRequest) (*RenewCertificateResponse, error)
// Connect is the long-lived control stream. The agent sends Hello first,
// then heartbeats and command acknowledgements; the server answers with
// Welcome and pushes commands.
Connect(grpc.BidiStreamingServer[ConnectRequest, ConnectResponse]) error
// GetDesiredState returns the revision the agent should run. Used for
// auto_pull and as fallback when the Connect stream is unavailable.
GetDesiredState(context.Context, *GetDesiredStateRequest) (*GetDesiredStateResponse, error)
// FetchBundle downloads the signed configuration bundle of a revision
// (docs/adr/0009-signierte-config-bundles.md).
FetchBundle(context.Context, *FetchBundleRequest) (*FetchBundleResponse, error)
// ReportDeployment reports the outcome of applying a revision.
ReportDeployment(context.Context, *ReportDeploymentRequest) (*ReportDeploymentResponse, error)
// ReportLeases sends a batch of DHCP lease observations (DHCP agents only).
ReportLeases(context.Context, *ReportLeasesRequest) (*ReportLeasesResponse, error)
mustEmbedUnimplementedAgentServiceServer()
}
// UnimplementedAgentServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAgentServiceServer struct{}
func (UnimplementedAgentServiceServer) Enroll(context.Context, *EnrollRequest) (*EnrollResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Enroll not implemented")
}
func (UnimplementedAgentServiceServer) RenewCertificate(context.Context, *RenewCertificateRequest) (*RenewCertificateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RenewCertificate not implemented")
}
func (UnimplementedAgentServiceServer) Connect(grpc.BidiStreamingServer[ConnectRequest, ConnectResponse]) error {
return status.Error(codes.Unimplemented, "method Connect not implemented")
}
func (UnimplementedAgentServiceServer) GetDesiredState(context.Context, *GetDesiredStateRequest) (*GetDesiredStateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetDesiredState not implemented")
}
func (UnimplementedAgentServiceServer) FetchBundle(context.Context, *FetchBundleRequest) (*FetchBundleResponse, error) {
return nil, status.Error(codes.Unimplemented, "method FetchBundle not implemented")
}
func (UnimplementedAgentServiceServer) ReportDeployment(context.Context, *ReportDeploymentRequest) (*ReportDeploymentResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ReportDeployment not implemented")
}
func (UnimplementedAgentServiceServer) ReportLeases(context.Context, *ReportLeasesRequest) (*ReportLeasesResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ReportLeases not implemented")
}
func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {}
func (UnimplementedAgentServiceServer) testEmbeddedByValue() {}
// UnsafeAgentServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AgentServiceServer will
// result in compilation errors.
type UnsafeAgentServiceServer interface {
mustEmbedUnimplementedAgentServiceServer()
}
func RegisterAgentServiceServer(s grpc.ServiceRegistrar, srv AgentServiceServer) {
// If the following call panics, it indicates UnimplementedAgentServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AgentService_ServiceDesc, srv)
}
func _AgentService_Enroll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(EnrollRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).Enroll(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_Enroll_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).Enroll(ctx, req.(*EnrollRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_RenewCertificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RenewCertificateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).RenewCertificate(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_RenewCertificate_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).RenewCertificate(ctx, req.(*RenewCertificateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_Connect_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(AgentServiceServer).Connect(&grpc.GenericServerStream[ConnectRequest, ConnectResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type AgentService_ConnectServer = grpc.BidiStreamingServer[ConnectRequest, ConnectResponse]
func _AgentService_GetDesiredState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDesiredStateRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).GetDesiredState(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_GetDesiredState_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).GetDesiredState(ctx, req.(*GetDesiredStateRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_FetchBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FetchBundleRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).FetchBundle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_FetchBundle_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).FetchBundle(ctx, req.(*FetchBundleRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_ReportDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReportDeploymentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).ReportDeployment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_ReportDeployment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).ReportDeployment(ctx, req.(*ReportDeploymentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_ReportLeases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReportLeasesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).ReportLeases(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_ReportLeases_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).ReportLeases(ctx, req.(*ReportLeasesRequest))
}
return interceptor(ctx, in, info, handler)
}
// AgentService_ServiceDesc is the grpc.ServiceDesc for AgentService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AgentService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ddi.agent.v1.AgentService",
HandlerType: (*AgentServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Enroll",
Handler: _AgentService_Enroll_Handler,
},
{
MethodName: "RenewCertificate",
Handler: _AgentService_RenewCertificate_Handler,
},
{
MethodName: "GetDesiredState",
Handler: _AgentService_GetDesiredState_Handler,
},
{
MethodName: "FetchBundle",
Handler: _AgentService_FetchBundle_Handler,
},
{
MethodName: "ReportDeployment",
Handler: _AgentService_ReportDeployment_Handler,
},
{
MethodName: "ReportLeases",
Handler: _AgentService_ReportLeases_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Connect",
Handler: _AgentService_Connect_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "ddi/agent/v1/agent.proto",
}