...

Source file src/github.com/datawire/ambassador/v2/pkg/api/agent/director_grpc.pb.go

Documentation: github.com/datawire/ambassador/v2/pkg/api/agent

     1  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     2  // versions:
     3  // - protoc-gen-go-grpc v1.2.0
     4  // - protoc             v3.21.5
     5  // source: agent/director.proto
     6  
     7  package agent
     8  
     9  import (
    10  	context "context"
    11  	grpc "google.golang.org/grpc"
    12  	codes "google.golang.org/grpc/codes"
    13  	status "google.golang.org/grpc/status"
    14  )
    15  
    16  // This is a compile-time assertion to ensure that this generated file
    17  // is compatible with the grpc package it is being compiled against.
    18  // Requires gRPC-Go v1.32.0 or later.
    19  const _ = grpc.SupportPackageIsVersion7
    20  
    21  // DirectorClient is the client API for Director service.
    22  //
    23  // 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.
    24  type DirectorClient interface {
    25  	// Deprecated: Do not use.
    26  	// Report a consistent Snapshot of information to the DCP.  This
    27  	// method is deprecated, you should call ReportStream instead.
    28  	Report(ctx context.Context, in *Snapshot, opts ...grpc.CallOption) (*SnapshotResponse, error)
    29  	// Report a consistent Snapshot of information to the DCP.
    30  	ReportStream(ctx context.Context, opts ...grpc.CallOption) (Director_ReportStreamClient, error)
    31  	// Stream metrics to the DCP.
    32  	StreamMetrics(ctx context.Context, opts ...grpc.CallOption) (Director_StreamMetricsClient, error)
    33  	// Retrieve Directives from the DCP
    34  	Retrieve(ctx context.Context, in *Identity, opts ...grpc.CallOption) (Director_RetrieveClient, error)
    35  	// Reports the result of a command execution to the cloud
    36  	ReportCommandResult(ctx context.Context, in *CommandResult, opts ...grpc.CallOption) (*CommandResultResponse, error)
    37  	RetrieveSnapshot(ctx context.Context, in *Identity, opts ...grpc.CallOption) (Director_RetrieveSnapshotClient, error)
    38  }
    39  
    40  type directorClient struct {
    41  	cc grpc.ClientConnInterface
    42  }
    43  
    44  func NewDirectorClient(cc grpc.ClientConnInterface) DirectorClient {
    45  	return &directorClient{cc}
    46  }
    47  
    48  // Deprecated: Do not use.
    49  func (c *directorClient) Report(ctx context.Context, in *Snapshot, opts ...grpc.CallOption) (*SnapshotResponse, error) {
    50  	out := new(SnapshotResponse)
    51  	err := c.cc.Invoke(ctx, "/agent.Director/Report", in, out, opts...)
    52  	if err != nil {
    53  		return nil, err
    54  	}
    55  	return out, nil
    56  }
    57  
    58  func (c *directorClient) ReportStream(ctx context.Context, opts ...grpc.CallOption) (Director_ReportStreamClient, error) {
    59  	stream, err := c.cc.NewStream(ctx, &Director_ServiceDesc.Streams[0], "/agent.Director/ReportStream", opts...)
    60  	if err != nil {
    61  		return nil, err
    62  	}
    63  	x := &directorReportStreamClient{stream}
    64  	return x, nil
    65  }
    66  
    67  type Director_ReportStreamClient interface {
    68  	Send(*RawSnapshotChunk) error
    69  	CloseAndRecv() (*SnapshotResponse, error)
    70  	grpc.ClientStream
    71  }
    72  
    73  type directorReportStreamClient struct {
    74  	grpc.ClientStream
    75  }
    76  
    77  func (x *directorReportStreamClient) Send(m *RawSnapshotChunk) error {
    78  	return x.ClientStream.SendMsg(m)
    79  }
    80  
    81  func (x *directorReportStreamClient) CloseAndRecv() (*SnapshotResponse, error) {
    82  	if err := x.ClientStream.CloseSend(); err != nil {
    83  		return nil, err
    84  	}
    85  	m := new(SnapshotResponse)
    86  	if err := x.ClientStream.RecvMsg(m); err != nil {
    87  		return nil, err
    88  	}
    89  	return m, nil
    90  }
    91  
    92  func (c *directorClient) StreamMetrics(ctx context.Context, opts ...grpc.CallOption) (Director_StreamMetricsClient, error) {
    93  	stream, err := c.cc.NewStream(ctx, &Director_ServiceDesc.Streams[1], "/agent.Director/StreamMetrics", opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	x := &directorStreamMetricsClient{stream}
    98  	return x, nil
    99  }
   100  
   101  type Director_StreamMetricsClient interface {
   102  	Send(*StreamMetricsMessage) error
   103  	CloseAndRecv() (*StreamMetricsResponse, error)
   104  	grpc.ClientStream
   105  }
   106  
   107  type directorStreamMetricsClient struct {
   108  	grpc.ClientStream
   109  }
   110  
   111  func (x *directorStreamMetricsClient) Send(m *StreamMetricsMessage) error {
   112  	return x.ClientStream.SendMsg(m)
   113  }
   114  
   115  func (x *directorStreamMetricsClient) CloseAndRecv() (*StreamMetricsResponse, error) {
   116  	if err := x.ClientStream.CloseSend(); err != nil {
   117  		return nil, err
   118  	}
   119  	m := new(StreamMetricsResponse)
   120  	if err := x.ClientStream.RecvMsg(m); err != nil {
   121  		return nil, err
   122  	}
   123  	return m, nil
   124  }
   125  
   126  func (c *directorClient) Retrieve(ctx context.Context, in *Identity, opts ...grpc.CallOption) (Director_RetrieveClient, error) {
   127  	stream, err := c.cc.NewStream(ctx, &Director_ServiceDesc.Streams[2], "/agent.Director/Retrieve", opts...)
   128  	if err != nil {
   129  		return nil, err
   130  	}
   131  	x := &directorRetrieveClient{stream}
   132  	if err := x.ClientStream.SendMsg(in); err != nil {
   133  		return nil, err
   134  	}
   135  	if err := x.ClientStream.CloseSend(); err != nil {
   136  		return nil, err
   137  	}
   138  	return x, nil
   139  }
   140  
   141  type Director_RetrieveClient interface {
   142  	Recv() (*Directive, error)
   143  	grpc.ClientStream
   144  }
   145  
   146  type directorRetrieveClient struct {
   147  	grpc.ClientStream
   148  }
   149  
   150  func (x *directorRetrieveClient) Recv() (*Directive, error) {
   151  	m := new(Directive)
   152  	if err := x.ClientStream.RecvMsg(m); err != nil {
   153  		return nil, err
   154  	}
   155  	return m, nil
   156  }
   157  
   158  func (c *directorClient) ReportCommandResult(ctx context.Context, in *CommandResult, opts ...grpc.CallOption) (*CommandResultResponse, error) {
   159  	out := new(CommandResultResponse)
   160  	err := c.cc.Invoke(ctx, "/agent.Director/ReportCommandResult", in, out, opts...)
   161  	if err != nil {
   162  		return nil, err
   163  	}
   164  	return out, nil
   165  }
   166  
   167  func (c *directorClient) RetrieveSnapshot(ctx context.Context, in *Identity, opts ...grpc.CallOption) (Director_RetrieveSnapshotClient, error) {
   168  	stream, err := c.cc.NewStream(ctx, &Director_ServiceDesc.Streams[3], "/agent.Director/RetrieveSnapshot", opts...)
   169  	if err != nil {
   170  		return nil, err
   171  	}
   172  	x := &directorRetrieveSnapshotClient{stream}
   173  	if err := x.ClientStream.SendMsg(in); err != nil {
   174  		return nil, err
   175  	}
   176  	if err := x.ClientStream.CloseSend(); err != nil {
   177  		return nil, err
   178  	}
   179  	return x, nil
   180  }
   181  
   182  type Director_RetrieveSnapshotClient interface {
   183  	Recv() (*RawSnapshotChunk, error)
   184  	grpc.ClientStream
   185  }
   186  
   187  type directorRetrieveSnapshotClient struct {
   188  	grpc.ClientStream
   189  }
   190  
   191  func (x *directorRetrieveSnapshotClient) Recv() (*RawSnapshotChunk, error) {
   192  	m := new(RawSnapshotChunk)
   193  	if err := x.ClientStream.RecvMsg(m); err != nil {
   194  		return nil, err
   195  	}
   196  	return m, nil
   197  }
   198  
   199  // DirectorServer is the server API for Director service.
   200  // All implementations must embed UnimplementedDirectorServer
   201  // for forward compatibility
   202  type DirectorServer interface {
   203  	// Deprecated: Do not use.
   204  	// Report a consistent Snapshot of information to the DCP.  This
   205  	// method is deprecated, you should call ReportStream instead.
   206  	Report(context.Context, *Snapshot) (*SnapshotResponse, error)
   207  	// Report a consistent Snapshot of information to the DCP.
   208  	ReportStream(Director_ReportStreamServer) error
   209  	// Stream metrics to the DCP.
   210  	StreamMetrics(Director_StreamMetricsServer) error
   211  	// Retrieve Directives from the DCP
   212  	Retrieve(*Identity, Director_RetrieveServer) error
   213  	// Reports the result of a command execution to the cloud
   214  	ReportCommandResult(context.Context, *CommandResult) (*CommandResultResponse, error)
   215  	RetrieveSnapshot(*Identity, Director_RetrieveSnapshotServer) error
   216  	mustEmbedUnimplementedDirectorServer()
   217  }
   218  
   219  // UnimplementedDirectorServer must be embedded to have forward compatible implementations.
   220  type UnimplementedDirectorServer struct {
   221  }
   222  
   223  func (UnimplementedDirectorServer) Report(context.Context, *Snapshot) (*SnapshotResponse, error) {
   224  	return nil, status.Errorf(codes.Unimplemented, "method Report not implemented")
   225  }
   226  func (UnimplementedDirectorServer) ReportStream(Director_ReportStreamServer) error {
   227  	return status.Errorf(codes.Unimplemented, "method ReportStream not implemented")
   228  }
   229  func (UnimplementedDirectorServer) StreamMetrics(Director_StreamMetricsServer) error {
   230  	return status.Errorf(codes.Unimplemented, "method StreamMetrics not implemented")
   231  }
   232  func (UnimplementedDirectorServer) Retrieve(*Identity, Director_RetrieveServer) error {
   233  	return status.Errorf(codes.Unimplemented, "method Retrieve not implemented")
   234  }
   235  func (UnimplementedDirectorServer) ReportCommandResult(context.Context, *CommandResult) (*CommandResultResponse, error) {
   236  	return nil, status.Errorf(codes.Unimplemented, "method ReportCommandResult not implemented")
   237  }
   238  func (UnimplementedDirectorServer) RetrieveSnapshot(*Identity, Director_RetrieveSnapshotServer) error {
   239  	return status.Errorf(codes.Unimplemented, "method RetrieveSnapshot not implemented")
   240  }
   241  func (UnimplementedDirectorServer) mustEmbedUnimplementedDirectorServer() {}
   242  
   243  // UnsafeDirectorServer may be embedded to opt out of forward compatibility for this service.
   244  // Use of this interface is not recommended, as added methods to DirectorServer will
   245  // result in compilation errors.
   246  type UnsafeDirectorServer interface {
   247  	mustEmbedUnimplementedDirectorServer()
   248  }
   249  
   250  func RegisterDirectorServer(s grpc.ServiceRegistrar, srv DirectorServer) {
   251  	s.RegisterService(&Director_ServiceDesc, srv)
   252  }
   253  
   254  func _Director_Report_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   255  	in := new(Snapshot)
   256  	if err := dec(in); err != nil {
   257  		return nil, err
   258  	}
   259  	if interceptor == nil {
   260  		return srv.(DirectorServer).Report(ctx, in)
   261  	}
   262  	info := &grpc.UnaryServerInfo{
   263  		Server:     srv,
   264  		FullMethod: "/agent.Director/Report",
   265  	}
   266  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   267  		return srv.(DirectorServer).Report(ctx, req.(*Snapshot))
   268  	}
   269  	return interceptor(ctx, in, info, handler)
   270  }
   271  
   272  func _Director_ReportStream_Handler(srv interface{}, stream grpc.ServerStream) error {
   273  	return srv.(DirectorServer).ReportStream(&directorReportStreamServer{stream})
   274  }
   275  
   276  type Director_ReportStreamServer interface {
   277  	SendAndClose(*SnapshotResponse) error
   278  	Recv() (*RawSnapshotChunk, error)
   279  	grpc.ServerStream
   280  }
   281  
   282  type directorReportStreamServer struct {
   283  	grpc.ServerStream
   284  }
   285  
   286  func (x *directorReportStreamServer) SendAndClose(m *SnapshotResponse) error {
   287  	return x.ServerStream.SendMsg(m)
   288  }
   289  
   290  func (x *directorReportStreamServer) Recv() (*RawSnapshotChunk, error) {
   291  	m := new(RawSnapshotChunk)
   292  	if err := x.ServerStream.RecvMsg(m); err != nil {
   293  		return nil, err
   294  	}
   295  	return m, nil
   296  }
   297  
   298  func _Director_StreamMetrics_Handler(srv interface{}, stream grpc.ServerStream) error {
   299  	return srv.(DirectorServer).StreamMetrics(&directorStreamMetricsServer{stream})
   300  }
   301  
   302  type Director_StreamMetricsServer interface {
   303  	SendAndClose(*StreamMetricsResponse) error
   304  	Recv() (*StreamMetricsMessage, error)
   305  	grpc.ServerStream
   306  }
   307  
   308  type directorStreamMetricsServer struct {
   309  	grpc.ServerStream
   310  }
   311  
   312  func (x *directorStreamMetricsServer) SendAndClose(m *StreamMetricsResponse) error {
   313  	return x.ServerStream.SendMsg(m)
   314  }
   315  
   316  func (x *directorStreamMetricsServer) Recv() (*StreamMetricsMessage, error) {
   317  	m := new(StreamMetricsMessage)
   318  	if err := x.ServerStream.RecvMsg(m); err != nil {
   319  		return nil, err
   320  	}
   321  	return m, nil
   322  }
   323  
   324  func _Director_Retrieve_Handler(srv interface{}, stream grpc.ServerStream) error {
   325  	m := new(Identity)
   326  	if err := stream.RecvMsg(m); err != nil {
   327  		return err
   328  	}
   329  	return srv.(DirectorServer).Retrieve(m, &directorRetrieveServer{stream})
   330  }
   331  
   332  type Director_RetrieveServer interface {
   333  	Send(*Directive) error
   334  	grpc.ServerStream
   335  }
   336  
   337  type directorRetrieveServer struct {
   338  	grpc.ServerStream
   339  }
   340  
   341  func (x *directorRetrieveServer) Send(m *Directive) error {
   342  	return x.ServerStream.SendMsg(m)
   343  }
   344  
   345  func _Director_ReportCommandResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   346  	in := new(CommandResult)
   347  	if err := dec(in); err != nil {
   348  		return nil, err
   349  	}
   350  	if interceptor == nil {
   351  		return srv.(DirectorServer).ReportCommandResult(ctx, in)
   352  	}
   353  	info := &grpc.UnaryServerInfo{
   354  		Server:     srv,
   355  		FullMethod: "/agent.Director/ReportCommandResult",
   356  	}
   357  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   358  		return srv.(DirectorServer).ReportCommandResult(ctx, req.(*CommandResult))
   359  	}
   360  	return interceptor(ctx, in, info, handler)
   361  }
   362  
   363  func _Director_RetrieveSnapshot_Handler(srv interface{}, stream grpc.ServerStream) error {
   364  	m := new(Identity)
   365  	if err := stream.RecvMsg(m); err != nil {
   366  		return err
   367  	}
   368  	return srv.(DirectorServer).RetrieveSnapshot(m, &directorRetrieveSnapshotServer{stream})
   369  }
   370  
   371  type Director_RetrieveSnapshotServer interface {
   372  	Send(*RawSnapshotChunk) error
   373  	grpc.ServerStream
   374  }
   375  
   376  type directorRetrieveSnapshotServer struct {
   377  	grpc.ServerStream
   378  }
   379  
   380  func (x *directorRetrieveSnapshotServer) Send(m *RawSnapshotChunk) error {
   381  	return x.ServerStream.SendMsg(m)
   382  }
   383  
   384  // Director_ServiceDesc is the grpc.ServiceDesc for Director service.
   385  // It's only intended for direct use with grpc.RegisterService,
   386  // and not to be introspected or modified (even as a copy)
   387  var Director_ServiceDesc = grpc.ServiceDesc{
   388  	ServiceName: "agent.Director",
   389  	HandlerType: (*DirectorServer)(nil),
   390  	Methods: []grpc.MethodDesc{
   391  		{
   392  			MethodName: "Report",
   393  			Handler:    _Director_Report_Handler,
   394  		},
   395  		{
   396  			MethodName: "ReportCommandResult",
   397  			Handler:    _Director_ReportCommandResult_Handler,
   398  		},
   399  	},
   400  	Streams: []grpc.StreamDesc{
   401  		{
   402  			StreamName:    "ReportStream",
   403  			Handler:       _Director_ReportStream_Handler,
   404  			ClientStreams: true,
   405  		},
   406  		{
   407  			StreamName:    "StreamMetrics",
   408  			Handler:       _Director_StreamMetrics_Handler,
   409  			ClientStreams: true,
   410  		},
   411  		{
   412  			StreamName:    "Retrieve",
   413  			Handler:       _Director_Retrieve_Handler,
   414  			ServerStreams: true,
   415  		},
   416  		{
   417  			StreamName:    "RetrieveSnapshot",
   418  			Handler:       _Director_RetrieveSnapshot_Handler,
   419  			ServerStreams: true,
   420  		},
   421  	},
   422  	Metadata: "agent/director.proto",
   423  }
   424  

View as plain text