agones.dev/agones@v1.54.0/pkg/sdk/alpha/alpha.pb.gw.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-grpc-gateway. DO NOT EDIT.
    17  // source: alpha.proto
    18  
    19  /*
    20  Package alpha is a reverse proxy.
    21  
    22  It translates gRPC into RESTful JSON APIs.
    23  */
    24  package alpha
    25  
    26  import (
    27  	"context"
    28  	"errors"
    29  	"io"
    30  	"net/http"
    31  
    32  	"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
    33  	"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
    34  	"google.golang.org/grpc"
    35  	"google.golang.org/grpc/codes"
    36  	"google.golang.org/grpc/grpclog"
    37  	"google.golang.org/grpc/metadata"
    38  	"google.golang.org/grpc/status"
    39  	"google.golang.org/protobuf/proto"
    40  )
    41  
    42  // Suppress "imported and not used" errors
    43  var (
    44  	_ codes.Code
    45  	_ io.Reader
    46  	_ status.Status
    47  	_ = errors.New
    48  	_ = runtime.String
    49  	_ = utilities.NewDoubleArray
    50  	_ = metadata.Join
    51  )
    52  
    53  func request_SDK_PlayerConnect_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    54  	var (
    55  		protoReq PlayerID
    56  		metadata runtime.ServerMetadata
    57  	)
    58  	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
    59  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
    60  	}
    61  	if req.Body != nil {
    62  		_, _ = io.Copy(io.Discard, req.Body)
    63  	}
    64  	msg, err := client.PlayerConnect(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
    65  	return msg, metadata, err
    66  }
    67  
    68  func local_request_SDK_PlayerConnect_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    69  	var (
    70  		protoReq PlayerID
    71  		metadata runtime.ServerMetadata
    72  	)
    73  	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
    74  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
    75  	}
    76  	msg, err := server.PlayerConnect(ctx, &protoReq)
    77  	return msg, metadata, err
    78  }
    79  
    80  func request_SDK_PlayerDisconnect_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    81  	var (
    82  		protoReq PlayerID
    83  		metadata runtime.ServerMetadata
    84  	)
    85  	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
    86  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
    87  	}
    88  	if req.Body != nil {
    89  		_, _ = io.Copy(io.Discard, req.Body)
    90  	}
    91  	msg, err := client.PlayerDisconnect(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
    92  	return msg, metadata, err
    93  }
    94  
    95  func local_request_SDK_PlayerDisconnect_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
    96  	var (
    97  		protoReq PlayerID
    98  		metadata runtime.ServerMetadata
    99  	)
   100  	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
   101  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   102  	}
   103  	msg, err := server.PlayerDisconnect(ctx, &protoReq)
   104  	return msg, metadata, err
   105  }
   106  
   107  func request_SDK_SetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   108  	var (
   109  		protoReq Count
   110  		metadata runtime.ServerMetadata
   111  	)
   112  	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
   113  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   114  	}
   115  	if req.Body != nil {
   116  		_, _ = io.Copy(io.Discard, req.Body)
   117  	}
   118  	msg, err := client.SetPlayerCapacity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
   119  	return msg, metadata, err
   120  }
   121  
   122  func local_request_SDK_SetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   123  	var (
   124  		protoReq Count
   125  		metadata runtime.ServerMetadata
   126  	)
   127  	if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
   128  		return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
   129  	}
   130  	msg, err := server.SetPlayerCapacity(ctx, &protoReq)
   131  	return msg, metadata, err
   132  }
   133  
   134  func request_SDK_GetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   135  	var (
   136  		protoReq Empty
   137  		metadata runtime.ServerMetadata
   138  	)
   139  	if req.Body != nil {
   140  		_, _ = io.Copy(io.Discard, req.Body)
   141  	}
   142  	msg, err := client.GetPlayerCapacity(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
   143  	return msg, metadata, err
   144  }
   145  
   146  func local_request_SDK_GetPlayerCapacity_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   147  	var (
   148  		protoReq Empty
   149  		metadata runtime.ServerMetadata
   150  	)
   151  	msg, err := server.GetPlayerCapacity(ctx, &protoReq)
   152  	return msg, metadata, err
   153  }
   154  
   155  func request_SDK_GetPlayerCount_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   156  	var (
   157  		protoReq Empty
   158  		metadata runtime.ServerMetadata
   159  	)
   160  	if req.Body != nil {
   161  		_, _ = io.Copy(io.Discard, req.Body)
   162  	}
   163  	msg, err := client.GetPlayerCount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
   164  	return msg, metadata, err
   165  }
   166  
   167  func local_request_SDK_GetPlayerCount_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   168  	var (
   169  		protoReq Empty
   170  		metadata runtime.ServerMetadata
   171  	)
   172  	msg, err := server.GetPlayerCount(ctx, &protoReq)
   173  	return msg, metadata, err
   174  }
   175  
   176  func request_SDK_IsPlayerConnected_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   177  	var (
   178  		protoReq PlayerID
   179  		metadata runtime.ServerMetadata
   180  		err      error
   181  	)
   182  	if req.Body != nil {
   183  		_, _ = io.Copy(io.Discard, req.Body)
   184  	}
   185  	val, ok := pathParams["playerID"]
   186  	if !ok {
   187  		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "playerID")
   188  	}
   189  	protoReq.PlayerID, err = runtime.String(val)
   190  	if err != nil {
   191  		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "playerID", err)
   192  	}
   193  	msg, err := client.IsPlayerConnected(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
   194  	return msg, metadata, err
   195  }
   196  
   197  func local_request_SDK_IsPlayerConnected_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   198  	var (
   199  		protoReq PlayerID
   200  		metadata runtime.ServerMetadata
   201  		err      error
   202  	)
   203  	val, ok := pathParams["playerID"]
   204  	if !ok {
   205  		return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "playerID")
   206  	}
   207  	protoReq.PlayerID, err = runtime.String(val)
   208  	if err != nil {
   209  		return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "playerID", err)
   210  	}
   211  	msg, err := server.IsPlayerConnected(ctx, &protoReq)
   212  	return msg, metadata, err
   213  }
   214  
   215  func request_SDK_GetConnectedPlayers_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   216  	var (
   217  		protoReq Empty
   218  		metadata runtime.ServerMetadata
   219  	)
   220  	if req.Body != nil {
   221  		_, _ = io.Copy(io.Discard, req.Body)
   222  	}
   223  	msg, err := client.GetConnectedPlayers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
   224  	return msg, metadata, err
   225  }
   226  
   227  func local_request_SDK_GetConnectedPlayers_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
   228  	var (
   229  		protoReq Empty
   230  		metadata runtime.ServerMetadata
   231  	)
   232  	msg, err := server.GetConnectedPlayers(ctx, &protoReq)
   233  	return msg, metadata, err
   234  }
   235  
   236  // RegisterSDKHandlerServer registers the http handlers for service SDK to "mux".
   237  // UnaryRPC     :call SDKServer directly.
   238  // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
   239  // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSDKHandlerFromEndpoint instead.
   240  // GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
   241  func RegisterSDKHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SDKServer) error {
   242  	mux.Handle(http.MethodPost, pattern_SDK_PlayerConnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   243  		ctx, cancel := context.WithCancel(req.Context())
   244  		defer cancel()
   245  		var stream runtime.ServerTransportStream
   246  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   247  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   248  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerConnect", runtime.WithHTTPPathPattern("/alpha/player/connect"))
   249  		if err != nil {
   250  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   251  			return
   252  		}
   253  		resp, md, err := local_request_SDK_PlayerConnect_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   254  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   255  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   256  		if err != nil {
   257  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   258  			return
   259  		}
   260  		forward_SDK_PlayerConnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   261  	})
   262  	mux.Handle(http.MethodPost, pattern_SDK_PlayerDisconnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   263  		ctx, cancel := context.WithCancel(req.Context())
   264  		defer cancel()
   265  		var stream runtime.ServerTransportStream
   266  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   267  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   268  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", runtime.WithHTTPPathPattern("/alpha/player/disconnect"))
   269  		if err != nil {
   270  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   271  			return
   272  		}
   273  		resp, md, err := local_request_SDK_PlayerDisconnect_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   274  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   275  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   276  		if err != nil {
   277  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   278  			return
   279  		}
   280  		forward_SDK_PlayerDisconnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   281  	})
   282  	mux.Handle(http.MethodPut, pattern_SDK_SetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   283  		ctx, cancel := context.WithCancel(req.Context())
   284  		defer cancel()
   285  		var stream runtime.ServerTransportStream
   286  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   287  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   288  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity"))
   289  		if err != nil {
   290  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   291  			return
   292  		}
   293  		resp, md, err := local_request_SDK_SetPlayerCapacity_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   294  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   295  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   296  		if err != nil {
   297  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   298  			return
   299  		}
   300  		forward_SDK_SetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   301  	})
   302  	mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   303  		ctx, cancel := context.WithCancel(req.Context())
   304  		defer cancel()
   305  		var stream runtime.ServerTransportStream
   306  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   307  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   308  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity"))
   309  		if err != nil {
   310  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   311  			return
   312  		}
   313  		resp, md, err := local_request_SDK_GetPlayerCapacity_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   314  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   315  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   316  		if err != nil {
   317  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   318  			return
   319  		}
   320  		forward_SDK_GetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   321  	})
   322  	mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   323  		ctx, cancel := context.WithCancel(req.Context())
   324  		defer cancel()
   325  		var stream runtime.ServerTransportStream
   326  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   327  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   328  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCount", runtime.WithHTTPPathPattern("/alpha/player/count"))
   329  		if err != nil {
   330  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   331  			return
   332  		}
   333  		resp, md, err := local_request_SDK_GetPlayerCount_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   334  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   335  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   336  		if err != nil {
   337  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   338  			return
   339  		}
   340  		forward_SDK_GetPlayerCount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   341  	})
   342  	mux.Handle(http.MethodGet, pattern_SDK_IsPlayerConnected_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   343  		ctx, cancel := context.WithCancel(req.Context())
   344  		defer cancel()
   345  		var stream runtime.ServerTransportStream
   346  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   347  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   348  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", runtime.WithHTTPPathPattern("/alpha/player/connected/{playerID}"))
   349  		if err != nil {
   350  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   351  			return
   352  		}
   353  		resp, md, err := local_request_SDK_IsPlayerConnected_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   354  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   355  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   356  		if err != nil {
   357  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   358  			return
   359  		}
   360  		forward_SDK_IsPlayerConnected_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   361  	})
   362  	mux.Handle(http.MethodGet, pattern_SDK_GetConnectedPlayers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   363  		ctx, cancel := context.WithCancel(req.Context())
   364  		defer cancel()
   365  		var stream runtime.ServerTransportStream
   366  		ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
   367  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   368  		annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", runtime.WithHTTPPathPattern("/alpha/player/connected"))
   369  		if err != nil {
   370  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   371  			return
   372  		}
   373  		resp, md, err := local_request_SDK_GetConnectedPlayers_0(annotatedContext, inboundMarshaler, server, req, pathParams)
   374  		md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
   375  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   376  		if err != nil {
   377  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   378  			return
   379  		}
   380  		forward_SDK_GetConnectedPlayers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   381  	})
   382  
   383  	return nil
   384  }
   385  
   386  // RegisterSDKHandlerFromEndpoint is same as RegisterSDKHandler but
   387  // automatically dials to "endpoint" and closes the connection when "ctx" gets done.
   388  func RegisterSDKHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
   389  	conn, err := grpc.NewClient(endpoint, opts...)
   390  	if err != nil {
   391  		return err
   392  	}
   393  	defer func() {
   394  		if err != nil {
   395  			if cerr := conn.Close(); cerr != nil {
   396  				grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
   397  			}
   398  			return
   399  		}
   400  		go func() {
   401  			<-ctx.Done()
   402  			if cerr := conn.Close(); cerr != nil {
   403  				grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
   404  			}
   405  		}()
   406  	}()
   407  	return RegisterSDKHandler(ctx, mux, conn)
   408  }
   409  
   410  // RegisterSDKHandler registers the http handlers for service SDK to "mux".
   411  // The handlers forward requests to the grpc endpoint over "conn".
   412  func RegisterSDKHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
   413  	return RegisterSDKHandlerClient(ctx, mux, NewSDKClient(conn))
   414  }
   415  
   416  // RegisterSDKHandlerClient registers the http handlers for service SDK
   417  // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SDKClient".
   418  // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SDKClient"
   419  // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
   420  // "SDKClient" to call the correct interceptors. This client ignores the HTTP middlewares.
   421  func RegisterSDKHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SDKClient) error {
   422  	mux.Handle(http.MethodPost, pattern_SDK_PlayerConnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   423  		ctx, cancel := context.WithCancel(req.Context())
   424  		defer cancel()
   425  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   426  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerConnect", runtime.WithHTTPPathPattern("/alpha/player/connect"))
   427  		if err != nil {
   428  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   429  			return
   430  		}
   431  		resp, md, err := request_SDK_PlayerConnect_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   432  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   433  		if err != nil {
   434  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   435  			return
   436  		}
   437  		forward_SDK_PlayerConnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   438  	})
   439  	mux.Handle(http.MethodPost, pattern_SDK_PlayerDisconnect_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   440  		ctx, cancel := context.WithCancel(req.Context())
   441  		defer cancel()
   442  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   443  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/PlayerDisconnect", runtime.WithHTTPPathPattern("/alpha/player/disconnect"))
   444  		if err != nil {
   445  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   446  			return
   447  		}
   448  		resp, md, err := request_SDK_PlayerDisconnect_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   449  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   450  		if err != nil {
   451  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   452  			return
   453  		}
   454  		forward_SDK_PlayerDisconnect_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   455  	})
   456  	mux.Handle(http.MethodPut, pattern_SDK_SetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   457  		ctx, cancel := context.WithCancel(req.Context())
   458  		defer cancel()
   459  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   460  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/SetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity"))
   461  		if err != nil {
   462  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   463  			return
   464  		}
   465  		resp, md, err := request_SDK_SetPlayerCapacity_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   466  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   467  		if err != nil {
   468  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   469  			return
   470  		}
   471  		forward_SDK_SetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   472  	})
   473  	mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCapacity_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   474  		ctx, cancel := context.WithCancel(req.Context())
   475  		defer cancel()
   476  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   477  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCapacity", runtime.WithHTTPPathPattern("/alpha/player/capacity"))
   478  		if err != nil {
   479  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   480  			return
   481  		}
   482  		resp, md, err := request_SDK_GetPlayerCapacity_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   483  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   484  		if err != nil {
   485  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   486  			return
   487  		}
   488  		forward_SDK_GetPlayerCapacity_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   489  	})
   490  	mux.Handle(http.MethodGet, pattern_SDK_GetPlayerCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   491  		ctx, cancel := context.WithCancel(req.Context())
   492  		defer cancel()
   493  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   494  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetPlayerCount", runtime.WithHTTPPathPattern("/alpha/player/count"))
   495  		if err != nil {
   496  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   497  			return
   498  		}
   499  		resp, md, err := request_SDK_GetPlayerCount_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   500  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   501  		if err != nil {
   502  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   503  			return
   504  		}
   505  		forward_SDK_GetPlayerCount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   506  	})
   507  	mux.Handle(http.MethodGet, pattern_SDK_IsPlayerConnected_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   508  		ctx, cancel := context.WithCancel(req.Context())
   509  		defer cancel()
   510  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   511  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/IsPlayerConnected", runtime.WithHTTPPathPattern("/alpha/player/connected/{playerID}"))
   512  		if err != nil {
   513  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   514  			return
   515  		}
   516  		resp, md, err := request_SDK_IsPlayerConnected_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   517  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   518  		if err != nil {
   519  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   520  			return
   521  		}
   522  		forward_SDK_IsPlayerConnected_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   523  	})
   524  	mux.Handle(http.MethodGet, pattern_SDK_GetConnectedPlayers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
   525  		ctx, cancel := context.WithCancel(req.Context())
   526  		defer cancel()
   527  		inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
   528  		annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetConnectedPlayers", runtime.WithHTTPPathPattern("/alpha/player/connected"))
   529  		if err != nil {
   530  			runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
   531  			return
   532  		}
   533  		resp, md, err := request_SDK_GetConnectedPlayers_0(annotatedContext, inboundMarshaler, client, req, pathParams)
   534  		annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
   535  		if err != nil {
   536  			runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
   537  			return
   538  		}
   539  		forward_SDK_GetConnectedPlayers_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
   540  	})
   541  	return nil
   542  }
   543  
   544  var (
   545  	pattern_SDK_PlayerConnect_0       = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "connect"}, ""))
   546  	pattern_SDK_PlayerDisconnect_0    = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "disconnect"}, ""))
   547  	pattern_SDK_SetPlayerCapacity_0   = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "capacity"}, ""))
   548  	pattern_SDK_GetPlayerCapacity_0   = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "capacity"}, ""))
   549  	pattern_SDK_GetPlayerCount_0      = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "count"}, ""))
   550  	pattern_SDK_IsPlayerConnected_0   = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"alpha", "player", "connected", "playerID"}, ""))
   551  	pattern_SDK_GetConnectedPlayers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "connected"}, ""))
   552  )
   553  
   554  var (
   555  	forward_SDK_PlayerConnect_0       = runtime.ForwardResponseMessage
   556  	forward_SDK_PlayerDisconnect_0    = runtime.ForwardResponseMessage
   557  	forward_SDK_SetPlayerCapacity_0   = runtime.ForwardResponseMessage
   558  	forward_SDK_GetPlayerCapacity_0   = runtime.ForwardResponseMessage
   559  	forward_SDK_GetPlayerCount_0      = runtime.ForwardResponseMessage
   560  	forward_SDK_IsPlayerConnected_0   = runtime.ForwardResponseMessage
   561  	forward_SDK_GetConnectedPlayers_0 = runtime.ForwardResponseMessage
   562  )