agones.dev/agones@v1.53.0/pkg/sdk/sdk_grpc.pb.go (about)

     1  // Copyright 2024 Google LLC All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // This code was autogenerated. Do not edit directly.
    16  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    17  // versions:
    18  // - protoc-gen-go-grpc v1.2.0
    19  // - protoc             v6.30.0
    20  // source: sdk.proto
    21  
    22  package sdk
    23  
    24  import (
    25  	context "context"
    26  
    27  	grpc "google.golang.org/grpc"
    28  	codes "google.golang.org/grpc/codes"
    29  	status "google.golang.org/grpc/status"
    30  )
    31  
    32  // This is a compile-time assertion to ensure that this generated file
    33  // is compatible with the grpc package it is being compiled against.
    34  // Requires gRPC-Go v1.32.0 or later.
    35  const _ = grpc.SupportPackageIsVersion7
    36  
    37  // SDKClient is the client API for SDK service.
    38  //
    39  // 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.
    40  type SDKClient interface {
    41  	// Call when the GameServer is ready
    42  	Ready(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
    43  	// Call to self Allocation the GameServer
    44  	Allocate(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
    45  	// Call when the GameServer is shutting down
    46  	Shutdown(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
    47  	// Send a Empty every d Duration to declare that this GameSever is healthy
    48  	Health(ctx context.Context, opts ...grpc.CallOption) (SDK_HealthClient, error)
    49  	// Retrieve the current GameServer data
    50  	GetGameServer(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GameServer, error)
    51  	// Send GameServer details whenever the GameServer is updated
    52  	WatchGameServer(ctx context.Context, in *Empty, opts ...grpc.CallOption) (SDK_WatchGameServerClient, error)
    53  	// Apply a Label to the backing GameServer metadata
    54  	SetLabel(ctx context.Context, in *KeyValue, opts ...grpc.CallOption) (*Empty, error)
    55  	// Apply a Annotation to the backing GameServer metadata
    56  	SetAnnotation(ctx context.Context, in *KeyValue, opts ...grpc.CallOption) (*Empty, error)
    57  	// Marks the GameServer as the Reserved state for Duration
    58  	Reserve(ctx context.Context, in *Duration, opts ...grpc.CallOption) (*Empty, error)
    59  }
    60  
    61  type sDKClient struct {
    62  	cc grpc.ClientConnInterface
    63  }
    64  
    65  func NewSDKClient(cc grpc.ClientConnInterface) SDKClient {
    66  	return &sDKClient{cc}
    67  }
    68  
    69  func (c *sDKClient) Ready(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
    70  	out := new(Empty)
    71  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/Ready", in, out, opts...)
    72  	if err != nil {
    73  		return nil, err
    74  	}
    75  	return out, nil
    76  }
    77  
    78  func (c *sDKClient) Allocate(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
    79  	out := new(Empty)
    80  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/Allocate", in, out, opts...)
    81  	if err != nil {
    82  		return nil, err
    83  	}
    84  	return out, nil
    85  }
    86  
    87  func (c *sDKClient) Shutdown(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
    88  	out := new(Empty)
    89  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/Shutdown", in, out, opts...)
    90  	if err != nil {
    91  		return nil, err
    92  	}
    93  	return out, nil
    94  }
    95  
    96  func (c *sDKClient) Health(ctx context.Context, opts ...grpc.CallOption) (SDK_HealthClient, error) {
    97  	stream, err := c.cc.NewStream(ctx, &SDK_ServiceDesc.Streams[0], "/agones.dev.sdk.SDK/Health", opts...)
    98  	if err != nil {
    99  		return nil, err
   100  	}
   101  	x := &sDKHealthClient{stream}
   102  	return x, nil
   103  }
   104  
   105  type SDK_HealthClient interface {
   106  	Send(*Empty) error
   107  	CloseAndRecv() (*Empty, error)
   108  	grpc.ClientStream
   109  }
   110  
   111  type sDKHealthClient struct {
   112  	grpc.ClientStream
   113  }
   114  
   115  func (x *sDKHealthClient) Send(m *Empty) error {
   116  	return x.ClientStream.SendMsg(m)
   117  }
   118  
   119  func (x *sDKHealthClient) CloseAndRecv() (*Empty, error) {
   120  	if err := x.ClientStream.CloseSend(); err != nil {
   121  		return nil, err
   122  	}
   123  	m := new(Empty)
   124  	if err := x.ClientStream.RecvMsg(m); err != nil {
   125  		return nil, err
   126  	}
   127  	return m, nil
   128  }
   129  
   130  func (c *sDKClient) GetGameServer(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GameServer, error) {
   131  	out := new(GameServer)
   132  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/GetGameServer", in, out, opts...)
   133  	if err != nil {
   134  		return nil, err
   135  	}
   136  	return out, nil
   137  }
   138  
   139  func (c *sDKClient) WatchGameServer(ctx context.Context, in *Empty, opts ...grpc.CallOption) (SDK_WatchGameServerClient, error) {
   140  	stream, err := c.cc.NewStream(ctx, &SDK_ServiceDesc.Streams[1], "/agones.dev.sdk.SDK/WatchGameServer", opts...)
   141  	if err != nil {
   142  		return nil, err
   143  	}
   144  	x := &sDKWatchGameServerClient{stream}
   145  	if err := x.ClientStream.SendMsg(in); err != nil {
   146  		return nil, err
   147  	}
   148  	if err := x.ClientStream.CloseSend(); err != nil {
   149  		return nil, err
   150  	}
   151  	return x, nil
   152  }
   153  
   154  type SDK_WatchGameServerClient interface {
   155  	Recv() (*GameServer, error)
   156  	grpc.ClientStream
   157  }
   158  
   159  type sDKWatchGameServerClient struct {
   160  	grpc.ClientStream
   161  }
   162  
   163  func (x *sDKWatchGameServerClient) Recv() (*GameServer, error) {
   164  	m := new(GameServer)
   165  	if err := x.ClientStream.RecvMsg(m); err != nil {
   166  		return nil, err
   167  	}
   168  	return m, nil
   169  }
   170  
   171  func (c *sDKClient) SetLabel(ctx context.Context, in *KeyValue, opts ...grpc.CallOption) (*Empty, error) {
   172  	out := new(Empty)
   173  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/SetLabel", in, out, opts...)
   174  	if err != nil {
   175  		return nil, err
   176  	}
   177  	return out, nil
   178  }
   179  
   180  func (c *sDKClient) SetAnnotation(ctx context.Context, in *KeyValue, opts ...grpc.CallOption) (*Empty, error) {
   181  	out := new(Empty)
   182  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/SetAnnotation", in, out, opts...)
   183  	if err != nil {
   184  		return nil, err
   185  	}
   186  	return out, nil
   187  }
   188  
   189  func (c *sDKClient) Reserve(ctx context.Context, in *Duration, opts ...grpc.CallOption) (*Empty, error) {
   190  	out := new(Empty)
   191  	err := c.cc.Invoke(ctx, "/agones.dev.sdk.SDK/Reserve", in, out, opts...)
   192  	if err != nil {
   193  		return nil, err
   194  	}
   195  	return out, nil
   196  }
   197  
   198  // SDKServer is the server API for SDK service.
   199  // All implementations should embed UnimplementedSDKServer
   200  // for forward compatibility
   201  type SDKServer interface {
   202  	// Call when the GameServer is ready
   203  	Ready(context.Context, *Empty) (*Empty, error)
   204  	// Call to self Allocation the GameServer
   205  	Allocate(context.Context, *Empty) (*Empty, error)
   206  	// Call when the GameServer is shutting down
   207  	Shutdown(context.Context, *Empty) (*Empty, error)
   208  	// Send a Empty every d Duration to declare that this GameSever is healthy
   209  	Health(SDK_HealthServer) error
   210  	// Retrieve the current GameServer data
   211  	GetGameServer(context.Context, *Empty) (*GameServer, error)
   212  	// Send GameServer details whenever the GameServer is updated
   213  	WatchGameServer(*Empty, SDK_WatchGameServerServer) error
   214  	// Apply a Label to the backing GameServer metadata
   215  	SetLabel(context.Context, *KeyValue) (*Empty, error)
   216  	// Apply a Annotation to the backing GameServer metadata
   217  	SetAnnotation(context.Context, *KeyValue) (*Empty, error)
   218  	// Marks the GameServer as the Reserved state for Duration
   219  	Reserve(context.Context, *Duration) (*Empty, error)
   220  }
   221  
   222  // UnimplementedSDKServer should be embedded to have forward compatible implementations.
   223  type UnimplementedSDKServer struct {
   224  }
   225  
   226  func (UnimplementedSDKServer) Ready(context.Context, *Empty) (*Empty, error) {
   227  	return nil, status.Errorf(codes.Unimplemented, "method Ready not implemented")
   228  }
   229  func (UnimplementedSDKServer) Allocate(context.Context, *Empty) (*Empty, error) {
   230  	return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
   231  }
   232  func (UnimplementedSDKServer) Shutdown(context.Context, *Empty) (*Empty, error) {
   233  	return nil, status.Errorf(codes.Unimplemented, "method Shutdown not implemented")
   234  }
   235  func (UnimplementedSDKServer) Health(SDK_HealthServer) error {
   236  	return status.Errorf(codes.Unimplemented, "method Health not implemented")
   237  }
   238  func (UnimplementedSDKServer) GetGameServer(context.Context, *Empty) (*GameServer, error) {
   239  	return nil, status.Errorf(codes.Unimplemented, "method GetGameServer not implemented")
   240  }
   241  func (UnimplementedSDKServer) WatchGameServer(*Empty, SDK_WatchGameServerServer) error {
   242  	return status.Errorf(codes.Unimplemented, "method WatchGameServer not implemented")
   243  }
   244  func (UnimplementedSDKServer) SetLabel(context.Context, *KeyValue) (*Empty, error) {
   245  	return nil, status.Errorf(codes.Unimplemented, "method SetLabel not implemented")
   246  }
   247  func (UnimplementedSDKServer) SetAnnotation(context.Context, *KeyValue) (*Empty, error) {
   248  	return nil, status.Errorf(codes.Unimplemented, "method SetAnnotation not implemented")
   249  }
   250  func (UnimplementedSDKServer) Reserve(context.Context, *Duration) (*Empty, error) {
   251  	return nil, status.Errorf(codes.Unimplemented, "method Reserve not implemented")
   252  }
   253  
   254  // UnsafeSDKServer may be embedded to opt out of forward compatibility for this service.
   255  // Use of this interface is not recommended, as added methods to SDKServer will
   256  // result in compilation errors.
   257  type UnsafeSDKServer interface {
   258  	mustEmbedUnimplementedSDKServer()
   259  }
   260  
   261  func RegisterSDKServer(s grpc.ServiceRegistrar, srv SDKServer) {
   262  	s.RegisterService(&SDK_ServiceDesc, srv)
   263  }
   264  
   265  func _SDK_Ready_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   266  	in := new(Empty)
   267  	if err := dec(in); err != nil {
   268  		return nil, err
   269  	}
   270  	if interceptor == nil {
   271  		return srv.(SDKServer).Ready(ctx, in)
   272  	}
   273  	info := &grpc.UnaryServerInfo{
   274  		Server:     srv,
   275  		FullMethod: "/agones.dev.sdk.SDK/Ready",
   276  	}
   277  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   278  		return srv.(SDKServer).Ready(ctx, req.(*Empty))
   279  	}
   280  	return interceptor(ctx, in, info, handler)
   281  }
   282  
   283  func _SDK_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   284  	in := new(Empty)
   285  	if err := dec(in); err != nil {
   286  		return nil, err
   287  	}
   288  	if interceptor == nil {
   289  		return srv.(SDKServer).Allocate(ctx, in)
   290  	}
   291  	info := &grpc.UnaryServerInfo{
   292  		Server:     srv,
   293  		FullMethod: "/agones.dev.sdk.SDK/Allocate",
   294  	}
   295  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   296  		return srv.(SDKServer).Allocate(ctx, req.(*Empty))
   297  	}
   298  	return interceptor(ctx, in, info, handler)
   299  }
   300  
   301  func _SDK_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   302  	in := new(Empty)
   303  	if err := dec(in); err != nil {
   304  		return nil, err
   305  	}
   306  	if interceptor == nil {
   307  		return srv.(SDKServer).Shutdown(ctx, in)
   308  	}
   309  	info := &grpc.UnaryServerInfo{
   310  		Server:     srv,
   311  		FullMethod: "/agones.dev.sdk.SDK/Shutdown",
   312  	}
   313  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   314  		return srv.(SDKServer).Shutdown(ctx, req.(*Empty))
   315  	}
   316  	return interceptor(ctx, in, info, handler)
   317  }
   318  
   319  func _SDK_Health_Handler(srv interface{}, stream grpc.ServerStream) error {
   320  	return srv.(SDKServer).Health(&sDKHealthServer{stream})
   321  }
   322  
   323  type SDK_HealthServer interface {
   324  	SendAndClose(*Empty) error
   325  	Recv() (*Empty, error)
   326  	grpc.ServerStream
   327  }
   328  
   329  type sDKHealthServer struct {
   330  	grpc.ServerStream
   331  }
   332  
   333  func (x *sDKHealthServer) SendAndClose(m *Empty) error {
   334  	return x.ServerStream.SendMsg(m)
   335  }
   336  
   337  func (x *sDKHealthServer) Recv() (*Empty, error) {
   338  	m := new(Empty)
   339  	if err := x.ServerStream.RecvMsg(m); err != nil {
   340  		return nil, err
   341  	}
   342  	return m, nil
   343  }
   344  
   345  func _SDK_GetGameServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   346  	in := new(Empty)
   347  	if err := dec(in); err != nil {
   348  		return nil, err
   349  	}
   350  	if interceptor == nil {
   351  		return srv.(SDKServer).GetGameServer(ctx, in)
   352  	}
   353  	info := &grpc.UnaryServerInfo{
   354  		Server:     srv,
   355  		FullMethod: "/agones.dev.sdk.SDK/GetGameServer",
   356  	}
   357  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   358  		return srv.(SDKServer).GetGameServer(ctx, req.(*Empty))
   359  	}
   360  	return interceptor(ctx, in, info, handler)
   361  }
   362  
   363  func _SDK_WatchGameServer_Handler(srv interface{}, stream grpc.ServerStream) error {
   364  	m := new(Empty)
   365  	if err := stream.RecvMsg(m); err != nil {
   366  		return err
   367  	}
   368  	return srv.(SDKServer).WatchGameServer(m, &sDKWatchGameServerServer{stream})
   369  }
   370  
   371  type SDK_WatchGameServerServer interface {
   372  	Send(*GameServer) error
   373  	grpc.ServerStream
   374  }
   375  
   376  type sDKWatchGameServerServer struct {
   377  	grpc.ServerStream
   378  }
   379  
   380  func (x *sDKWatchGameServerServer) Send(m *GameServer) error {
   381  	return x.ServerStream.SendMsg(m)
   382  }
   383  
   384  func _SDK_SetLabel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   385  	in := new(KeyValue)
   386  	if err := dec(in); err != nil {
   387  		return nil, err
   388  	}
   389  	if interceptor == nil {
   390  		return srv.(SDKServer).SetLabel(ctx, in)
   391  	}
   392  	info := &grpc.UnaryServerInfo{
   393  		Server:     srv,
   394  		FullMethod: "/agones.dev.sdk.SDK/SetLabel",
   395  	}
   396  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   397  		return srv.(SDKServer).SetLabel(ctx, req.(*KeyValue))
   398  	}
   399  	return interceptor(ctx, in, info, handler)
   400  }
   401  
   402  func _SDK_SetAnnotation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   403  	in := new(KeyValue)
   404  	if err := dec(in); err != nil {
   405  		return nil, err
   406  	}
   407  	if interceptor == nil {
   408  		return srv.(SDKServer).SetAnnotation(ctx, in)
   409  	}
   410  	info := &grpc.UnaryServerInfo{
   411  		Server:     srv,
   412  		FullMethod: "/agones.dev.sdk.SDK/SetAnnotation",
   413  	}
   414  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   415  		return srv.(SDKServer).SetAnnotation(ctx, req.(*KeyValue))
   416  	}
   417  	return interceptor(ctx, in, info, handler)
   418  }
   419  
   420  func _SDK_Reserve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   421  	in := new(Duration)
   422  	if err := dec(in); err != nil {
   423  		return nil, err
   424  	}
   425  	if interceptor == nil {
   426  		return srv.(SDKServer).Reserve(ctx, in)
   427  	}
   428  	info := &grpc.UnaryServerInfo{
   429  		Server:     srv,
   430  		FullMethod: "/agones.dev.sdk.SDK/Reserve",
   431  	}
   432  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   433  		return srv.(SDKServer).Reserve(ctx, req.(*Duration))
   434  	}
   435  	return interceptor(ctx, in, info, handler)
   436  }
   437  
   438  // SDK_ServiceDesc is the grpc.ServiceDesc for SDK service.
   439  // It's only intended for direct use with grpc.RegisterService,
   440  // and not to be introspected or modified (even as a copy)
   441  var SDK_ServiceDesc = grpc.ServiceDesc{
   442  	ServiceName: "agones.dev.sdk.SDK",
   443  	HandlerType: (*SDKServer)(nil),
   444  	Methods: []grpc.MethodDesc{
   445  		{
   446  			MethodName: "Ready",
   447  			Handler:    _SDK_Ready_Handler,
   448  		},
   449  		{
   450  			MethodName: "Allocate",
   451  			Handler:    _SDK_Allocate_Handler,
   452  		},
   453  		{
   454  			MethodName: "Shutdown",
   455  			Handler:    _SDK_Shutdown_Handler,
   456  		},
   457  		{
   458  			MethodName: "GetGameServer",
   459  			Handler:    _SDK_GetGameServer_Handler,
   460  		},
   461  		{
   462  			MethodName: "SetLabel",
   463  			Handler:    _SDK_SetLabel_Handler,
   464  		},
   465  		{
   466  			MethodName: "SetAnnotation",
   467  			Handler:    _SDK_SetAnnotation_Handler,
   468  		},
   469  		{
   470  			MethodName: "Reserve",
   471  			Handler:    _SDK_Reserve_Handler,
   472  		},
   473  	},
   474  	Streams: []grpc.StreamDesc{
   475  		{
   476  			StreamName:    "Health",
   477  			Handler:       _SDK_Health_Handler,
   478  			ClientStreams: true,
   479  		},
   480  		{
   481  			StreamName:    "WatchGameServer",
   482  			Handler:       _SDK_WatchGameServer_Handler,
   483  			ServerStreams: true,
   484  		},
   485  	},
   486  	Metadata: "sdk.proto",
   487  }