diff --git a/build/Makefile b/build/Makefile index bfca68cce6..2f43552fd2 100644 --- a/build/Makefile +++ b/build/Makefile @@ -61,7 +61,7 @@ KIND_PROFILE ?= agones KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane # Game Server image to use while doing end-to-end tests -GS_TEST_IMAGE ?= us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 +GS_TEST_IMAGE ?= us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 # Enable all beta feature gates. Keep in sync with `true` (beta) entries in pkg/util/runtime/features.go:featureDefaults BETA_FEATURE_GATES ?= "CountsAndLists=true&DisableResyncOnSDKServer=true" diff --git a/build/build-sdk-images/csharp/gen.sh b/build/build-sdk-images/csharp/gen.sh old mode 100644 new mode 100755 index d4c0fdfdd8..3a2dbb798b --- a/build/build-sdk-images/csharp/gen.sh +++ b/build/build-sdk-images/csharp/gen.sh @@ -49,4 +49,15 @@ sed -i -z 's/produces: "application\/json";\n};//' ${csharp_proto_file_output_di sed -i -e 's/bool bool = 1.*/bool bool = 1;/' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto sed -i -e 's/^ *$//' ${csharp_proto_file_output_dir}/sdk/alpha/alpha.proto +sed -i -e 's/import "protoc-gen-openapiv2\/options\/annotations.proto";//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/info: {//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/title: "beta.proto";//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -z 's/version: "version not set";\n };//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/schemes: HTTP;//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/consumes: "application\/json";//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -z 's/produces: "application\/json";\n};//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/bool bool = 1.*/bool bool = 1;/' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto +sed -i -e 's/^ *$//' ${csharp_proto_file_output_dir}/sdk/beta/beta.proto + echo "csharp code is generated at build time" diff --git a/build/build-sdk-images/restapi/gen.sh b/build/build-sdk-images/restapi/gen.sh index c1f71a39a6..a6fd4e71d9 100644 --- a/build/build-sdk-images/restapi/gen.sh +++ b/build/build-sdk-images/restapi/gen.sh @@ -20,9 +20,11 @@ header() { wget -q https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.51/swagger-codegen-cli-3.0.51.jar -O /tmp/swagger-codegen-cli.jar -rm -rf /go/src/agones.dev/agones/test/sdk/restapi/swagger /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger +rm -rf /go/src/agones.dev/agones/test/sdk/restapi/swagger /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger java -jar /tmp/swagger-codegen-cli.jar generate -i /go/src/agones.dev/agones/sdks/swagger/sdk.swagger.json -l go -o /go/src/agones.dev/agones/test/sdk/restapi/swagger java -jar /tmp/swagger-codegen-cli.jar generate -i /go/src/agones.dev/agones/sdks/swagger/alpha.swagger.json -l go -o /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger +java -jar /tmp/swagger-codegen-cli.jar generate -i /go/src/agones.dev/agones/sdks/swagger/beta.swagger.json -l go -o /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger + # remove un-used files rm -rf /go/src/agones.dev/agones/test/sdk/restapi/swagger/.* @@ -35,6 +37,12 @@ rm -rf /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger/*.md rm -rf /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger/*.sh rm -rf /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger/docs rm -rf /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger/api +rm -rf /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger/.* +rm -rf /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger/*.md +rm -rf /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger/*.sh +rm -rf /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger/docs +rm -rf /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger/api + for file in `ls /go/src/agones.dev/agones/test/sdk/restapi/swagger` do @@ -45,3 +53,8 @@ for alpha in `ls /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger` do header /go/src/agones.dev/agones/test/sdk/restapi/alpha/swagger/${alpha} done + +for beta in `ls /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger` +do + header /go/src/agones.dev/agones/test/sdk/restapi/beta/swagger/${beta} +done diff --git a/cmd/sdk-server/main.go b/cmd/sdk-server/main.go index aa2bafa18b..859e1ebc57 100644 --- a/cmd/sdk-server/main.go +++ b/cmd/sdk-server/main.go @@ -25,7 +25,6 @@ import ( "strings" "time" - agonesv1 "agones.dev/agones/pkg/apis/agones/v1" gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -38,6 +37,7 @@ import ( "k8s.io/client-go/rest" "agones.dev/agones/pkg" + agonesv1 "agones.dev/agones/pkg/apis/agones/v1" "agones.dev/agones/pkg/client/clientset/versioned" "agones.dev/agones/pkg/sdk" sdkalpha "agones.dev/agones/pkg/sdk/alpha" @@ -202,6 +202,7 @@ func registerLocal(grpcServer *grpc.Server, ctlConf config) (func(), error) { sdk.RegisterSDKServer(grpcServer, s) sdkalpha.RegisterSDKServer(grpcServer, s) sdkbeta.RegisterSDKServer(grpcServer, s) + return func() { s.Close() }, err @@ -252,10 +253,15 @@ func runGateway(ctx context.Context, grpcEndpoint string, mux *gwruntime.ServeMu if err := sdk.RegisterSDKHandler(ctx, mux, conn); err != nil { logger.WithError(err).Fatal("Could not register sdk grpc-gateway") } + if err := sdkalpha.RegisterSDKHandler(ctx, mux, conn); err != nil { logger.WithError(err).Fatal("Could not register alpha sdk grpc-gateway") } + if err := sdkbeta.RegisterSDKHandler(ctx, mux, conn); err != nil { + logger.WithError(err).Fatal("Could not register beta sdk grpc-gateway") + } + logger.WithField("httpEndpoint", httpServer.Addr).Info("Starting SDKServer grpc-gateway...") if err := httpServer.ListenAndServe(); err != nil { if err == http.ErrServerClosed { diff --git a/examples/crd-client/create-gs.yaml b/examples/crd-client/create-gs.yaml index 567b63e9b0..edf6d096cd 100644 --- a/examples/crd-client/create-gs.yaml +++ b/examples/crd-client/create-gs.yaml @@ -38,5 +38,5 @@ spec: imagePullPolicy: Always env: - name: GAMESERVER_IMAGE - value: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + value: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 restartPolicy: Never diff --git a/examples/fleet.yaml b/examples/fleet.yaml index 0a1d359089..57132fd2e3 100644 --- a/examples/fleet.yaml +++ b/examples/fleet.yaml @@ -114,4 +114,4 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 diff --git a/examples/gameserver.yaml b/examples/gameserver.yaml index 17e86dc69e..172e8e7e8e 100644 --- a/examples/gameserver.yaml +++ b/examples/gameserver.yaml @@ -116,7 +116,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 imagePullPolicy: Always # nodeSelector is a label that can be used to tell Kubernetes which host # OS to use. For Windows game servers uncomment the nodeSelector diff --git a/examples/simple-game-server/Makefile b/examples/simple-game-server/Makefile index 4ed7c9f02a..8004757813 100644 --- a/examples/simple-game-server/Makefile +++ b/examples/simple-game-server/Makefile @@ -38,7 +38,7 @@ WITH_ARM64 ?= 1 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) project_path := $(dir $(mkfile_path)) -version := 0.31 +version := 0.32 ifeq ($(REPOSITORY),) server_tag := simple-game-server:$(version) else diff --git a/examples/simple-game-server/dev-gameserver.yaml b/examples/simple-game-server/dev-gameserver.yaml index 9b22f6a788..a37164eb4f 100644 --- a/examples/simple-game-server/dev-gameserver.yaml +++ b/examples/simple-game-server/dev-gameserver.yaml @@ -31,4 +31,4 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 diff --git a/examples/simple-game-server/fleet-distributed.yaml b/examples/simple-game-server/fleet-distributed.yaml index 9b6be7f3e5..636180c298 100644 --- a/examples/simple-game-server/fleet-distributed.yaml +++ b/examples/simple-game-server/fleet-distributed.yaml @@ -32,7 +32,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 resources: requests: memory: 64Mi diff --git a/examples/simple-game-server/fleet-tcp.yaml b/examples/simple-game-server/fleet-tcp.yaml index 8d94bf5336..74662be94e 100644 --- a/examples/simple-game-server/fleet-tcp.yaml +++ b/examples/simple-game-server/fleet-tcp.yaml @@ -28,7 +28,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 env: # Disables the UDP listener (Enabled by default) - name: UDP diff --git a/examples/simple-game-server/fleet.yaml b/examples/simple-game-server/fleet.yaml index 877b1d918b..ec0a5a5f95 100644 --- a/examples/simple-game-server/fleet.yaml +++ b/examples/simple-game-server/fleet.yaml @@ -27,7 +27,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 resources: requests: memory: 64Mi diff --git a/examples/simple-game-server/gameserver-passthrough.yaml b/examples/simple-game-server/gameserver-passthrough.yaml index dc0ab901f2..ea5b5265c4 100644 --- a/examples/simple-game-server/gameserver-passthrough.yaml +++ b/examples/simple-game-server/gameserver-passthrough.yaml @@ -24,7 +24,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 env: - name: PASSTHROUGH value: 'TRUE' diff --git a/examples/simple-game-server/gameserver-windows.yaml b/examples/simple-game-server/gameserver-windows.yaml index 4bdb2231f4..93c0496f52 100644 --- a/examples/simple-game-server/gameserver-windows.yaml +++ b/examples/simple-game-server/gameserver-windows.yaml @@ -25,7 +25,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 resources: requests: memory: 64Mi diff --git a/examples/simple-game-server/gameserver.yaml b/examples/simple-game-server/gameserver.yaml index 40f5e7d4b6..b1bbea0053 100644 --- a/examples/simple-game-server/gameserver.yaml +++ b/examples/simple-game-server/gameserver.yaml @@ -25,7 +25,7 @@ spec: spec: containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 resources: requests: memory: 64Mi diff --git a/examples/simple-game-server/main.go b/examples/simple-game-server/main.go index b1b950b38d..3a901c02af 100644 --- a/examples/simple-game-server/main.go +++ b/examples/simple-game-server/main.go @@ -690,7 +690,7 @@ func getPlayerCount(s *sdk.SDK) string { // getCounterCount returns the Count of the given Counter as a string func getCounterCount(s *sdk.SDK, counterName string) (string, error) { log.Printf("Retrieving Counter %s Count", counterName) - count, err := s.Alpha().GetCounterCount(counterName) + count, err := s.Beta().GetCounterCount(counterName) if err != nil { log.Printf("Error getting Counter %s Count: %s", counterName, err) return strconv.FormatInt(count, 10), err @@ -705,7 +705,7 @@ func incrementCounter(s *sdk.SDK, counterName string, amount string) (string, er return "", fmt.Errorf("Could not increment Counter %s by unparseable amount %s: %s", counterName, amount, err) } log.Printf("Incrementing Counter %s Count by amount %d", counterName, amountInt) - err = s.Alpha().IncrementCounter(counterName, amountInt) + err = s.Beta().IncrementCounter(counterName, amountInt) if err != nil { log.Printf("Error incrementing Counter %s Count by amount %d: %s", counterName, amountInt, err) return "", err @@ -720,7 +720,7 @@ func decrementCounter(s *sdk.SDK, counterName string, amount string) (string, er return "", fmt.Errorf("could not decrement Counter %s by unparseable amount %s: %s", counterName, amount, err) } log.Printf("Decrementing Counter %s Count by amount %d", counterName, amountInt) - err = s.Alpha().DecrementCounter(counterName, amountInt) + err = s.Beta().DecrementCounter(counterName, amountInt) if err != nil { log.Printf("Error decrementing Counter %s Count by amount %d: %s", counterName, amountInt, err) return "", err @@ -735,7 +735,7 @@ func setCounterCount(s *sdk.SDK, counterName string, amount string) (string, err return "", fmt.Errorf("could not set Counter %s to unparseable amount %s: %s", counterName, amount, err) } log.Printf("Setting Counter %s Count to amount %d", counterName, amountInt) - err = s.Alpha().SetCounterCount(counterName, amountInt) + err = s.Beta().SetCounterCount(counterName, amountInt) if err != nil { log.Printf("Error setting Counter %s Count by amount %d: %s", counterName, amountInt, err) return "", err @@ -746,7 +746,7 @@ func setCounterCount(s *sdk.SDK, counterName string, amount string) (string, err // getCounterCapacity returns the Capacity of the given Counter as a string func getCounterCapacity(s *sdk.SDK, counterName string) (string, error) { log.Printf("Retrieving Counter %s Capacity", counterName) - count, err := s.Alpha().GetCounterCapacity(counterName) + count, err := s.Beta().GetCounterCapacity(counterName) if err != nil { log.Printf("Error getting Counter %s Capacity: %s", counterName, err) return strconv.FormatInt(count, 10), err @@ -761,7 +761,7 @@ func setCounterCapacity(s *sdk.SDK, counterName string, amount string) (string, return "", fmt.Errorf("could not set Counter %s to unparseable amount %s: %s", counterName, amount, err) } log.Printf("Setting Counter %s Capacity to amount %d", counterName, amountInt) - err = s.Alpha().SetCounterCapacity(counterName, amountInt) + err = s.Beta().SetCounterCapacity(counterName, amountInt) if err != nil { log.Printf("Error setting Counter %s Capacity to amount %d: %s", counterName, amountInt, err) return "", err @@ -772,7 +772,7 @@ func setCounterCapacity(s *sdk.SDK, counterName string, amount string) (string, // getListCapacity returns the Capacity of the given List as a string func getListCapacity(s *sdk.SDK, listName string) (string, error) { log.Printf("Retrieving List %s Capacity", listName) - capacity, err := s.Alpha().GetListCapacity(listName) + capacity, err := s.Beta().GetListCapacity(listName) if err != nil { log.Printf("Error getting List %s Capacity: %s", listName, err) return strconv.FormatInt(capacity, 10), err @@ -787,7 +787,7 @@ func setListCapacity(s *sdk.SDK, listName string, amount string) (string, error) return "", fmt.Errorf("could not set List %s to unparseable amount %s: %s", listName, amount, err) } log.Printf("Setting List %s Capacity to amount %d", listName, amountInt) - err = s.Alpha().SetListCapacity(listName, amountInt) + err = s.Beta().SetListCapacity(listName, amountInt) if err != nil { log.Printf("Error setting List %s Capacity to amount %d: %s", listName, amountInt, err) return "", err @@ -798,7 +798,7 @@ func setListCapacity(s *sdk.SDK, listName string, amount string) (string, error) // listContains returns true if the given value is in the given List, false otherwise func listContains(s *sdk.SDK, listName string, value string) (string, error) { log.Printf("Getting List %s contains value %s", listName, value) - ok, err := s.Alpha().ListContains(listName, value) + ok, err := s.Beta().ListContains(listName, value) if err != nil { log.Printf("Error getting List %s contains value %s: %s", listName, value, err) return strconv.FormatBool(ok), err @@ -809,7 +809,7 @@ func listContains(s *sdk.SDK, listName string, value string) (string, error) { // getListLength returns the length (number of values) of the given List as a string func getListLength(s *sdk.SDK, listName string) (string, error) { log.Printf("Getting List %s length", listName) - length, err := s.Alpha().GetListLength(listName) + length, err := s.Beta().GetListLength(listName) if err != nil { log.Printf("Error getting List %s length: %s", listName, err) return strconv.Itoa(length), err @@ -820,7 +820,7 @@ func getListLength(s *sdk.SDK, listName string) (string, error) { // getListValues return the values in the given List as a comma delineated string func getListValues(s *sdk.SDK, listName string) (string, error) { log.Printf("Getting List %s values", listName) - values, err := s.Alpha().GetListValues(listName) + values, err := s.Beta().GetListValues(listName) if err != nil { log.Printf("Error getting List %s values: %s", listName, err) return "INVALID LIST NAME", err @@ -834,7 +834,7 @@ func getListValues(s *sdk.SDK, listName string) (string, error) { // appendListValue returns if the given value was successfuly added to the List or not func appendListValue(s *sdk.SDK, listName string, value string) (string, error) { log.Printf("Appending Value %s to List %s", value, listName) - err := s.Alpha().AppendListValue(listName, value) + err := s.Beta().AppendListValue(listName, value) if err != nil { log.Printf("Error appending Value %s to List %s: %s", value, listName, err) return "", err @@ -845,7 +845,7 @@ func appendListValue(s *sdk.SDK, listName string, value string) (string, error) // deleteListValue returns if the given value was successfuly deleted from the List or not func deleteListValue(s *sdk.SDK, listName string, value string) (string, error) { log.Printf("Deleting Value %s from List %s", value, listName) - err := s.Alpha().DeleteListValue(listName, value) + err := s.Beta().DeleteListValue(listName, value) if err != nil { log.Printf("Error deleting Value %s to List %s: %s", value, listName, err) return "", err diff --git a/install/helm/agones/templates/tests/test-runner.yaml b/install/helm/agones/templates/tests/test-runner.yaml index 8f56e7f606..98507158bd 100644 --- a/install/helm/agones/templates/tests/test-runner.yaml +++ b/install/helm/agones/templates/tests/test-runner.yaml @@ -29,7 +29,7 @@ spec: imagePullPolicy: Always env: - name: GAMESERVER_IMAGE - value: "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31" + value: "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32" - name: IS_HELM_TEST value: "true" - name: GAMESERVERS_NAMESPACE diff --git a/pkg/sdk/alpha/alpha.pb.go b/pkg/sdk/alpha/alpha.pb.go index 45e60419dd..ad7b760e4b 100644 --- a/pkg/sdk/alpha/alpha.pb.go +++ b/pkg/sdk/alpha/alpha.pb.go @@ -43,9 +43,6 @@ import ( _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/emptypb" - fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" - wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) const ( @@ -286,532 +283,6 @@ func (x *PlayerIDList) GetList() []string { return nil } -// A representation of a Counter. -type Counter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the Counter - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The current count of the Counter - Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` - // The maximum capacity of the Counter - Capacity int64 `protobuf:"varint,3,opt,name=capacity,proto3" json:"capacity,omitempty"` -} - -func (x *Counter) Reset() { - *x = Counter{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Counter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Counter) ProtoMessage() {} - -func (x *Counter) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Counter.ProtoReflect.Descriptor instead. -func (*Counter) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{5} -} - -func (x *Counter) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Counter) GetCount() int64 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *Counter) GetCapacity() int64 { - if x != nil { - return x.Capacity - } - return 0 -} - -// A representation of a Counter Update Request. -type CounterUpdateRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the Counter to update - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The value to set the Counter Count - Count *wrapperspb.Int64Value `protobuf:"bytes,2,opt,name=count,proto3" json:"count,omitempty"` - // The value to set the Counter Capacity - Capacity *wrapperspb.Int64Value `protobuf:"bytes,3,opt,name=capacity,proto3" json:"capacity,omitempty"` - // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement - // (negative), 0 if a CountSet or CapacitySet request - CountDiff int64 `protobuf:"varint,4,opt,name=countDiff,proto3" json:"countDiff,omitempty"` -} - -func (x *CounterUpdateRequest) Reset() { - *x = CounterUpdateRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CounterUpdateRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CounterUpdateRequest) ProtoMessage() {} - -func (x *CounterUpdateRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CounterUpdateRequest.ProtoReflect.Descriptor instead. -func (*CounterUpdateRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{6} -} - -func (x *CounterUpdateRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CounterUpdateRequest) GetCount() *wrapperspb.Int64Value { - if x != nil { - return x.Count - } - return nil -} - -func (x *CounterUpdateRequest) GetCapacity() *wrapperspb.Int64Value { - if x != nil { - return x.Capacity - } - return nil -} - -func (x *CounterUpdateRequest) GetCountDiff() int64 { - if x != nil { - return x.CountDiff - } - return 0 -} - -type GetCounterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the Counter to get - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *GetCounterRequest) Reset() { - *x = GetCounterRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetCounterRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetCounterRequest) ProtoMessage() {} - -func (x *GetCounterRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetCounterRequest.ProtoReflect.Descriptor instead. -func (*GetCounterRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{7} -} - -func (x *GetCounterRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateCounterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The requested update to make to the Counter - CounterUpdateRequest *CounterUpdateRequest `protobuf:"bytes,1,opt,name=counterUpdateRequest,proto3" json:"counterUpdateRequest,omitempty"` -} - -func (x *UpdateCounterRequest) Reset() { - *x = UpdateCounterRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCounterRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCounterRequest) ProtoMessage() {} - -func (x *UpdateCounterRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCounterRequest.ProtoReflect.Descriptor instead. -func (*UpdateCounterRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{8} -} - -func (x *UpdateCounterRequest) GetCounterUpdateRequest() *CounterUpdateRequest { - if x != nil { - return x.CounterUpdateRequest - } - return nil -} - -// A representation of a List. -type List struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the List - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The maximum capacity of the List - Capacity int64 `protobuf:"varint,2,opt,name=capacity,proto3" json:"capacity,omitempty"` - // The array of items in the List ["v1", "v2", …] - Values []string `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"` -} - -func (x *List) Reset() { - *x = List{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *List) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*List) ProtoMessage() {} - -func (x *List) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use List.ProtoReflect.Descriptor instead. -func (*List) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{9} -} - -func (x *List) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *List) GetCapacity() int64 { - if x != nil { - return x.Capacity - } - return 0 -} - -func (x *List) GetValues() []string { - if x != nil { - return x.Values - } - return nil -} - -type GetListRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the List to get - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *GetListRequest) Reset() { - *x = GetListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetListRequest) ProtoMessage() {} - -func (x *GetListRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetListRequest.ProtoReflect.Descriptor instead. -func (*GetListRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{10} -} - -func (x *GetListRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -type UpdateListRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The List to update - List *List `protobuf:"bytes,1,opt,name=list,proto3" json:"list,omitempty"` - // Required. Mask (list) of fields to update. - // Fields are specified relative to the List - // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` -} - -func (x *UpdateListRequest) Reset() { - *x = UpdateListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateListRequest) ProtoMessage() {} - -func (x *UpdateListRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateListRequest.ProtoReflect.Descriptor instead. -func (*UpdateListRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{11} -} - -func (x *UpdateListRequest) GetList() *List { - if x != nil { - return x.List - } - return nil -} - -func (x *UpdateListRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type AddListValueRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the List to add a value to. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *AddListValueRequest) Reset() { - *x = AddListValueRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AddListValueRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AddListValueRequest) ProtoMessage() {} - -func (x *AddListValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AddListValueRequest.ProtoReflect.Descriptor instead. -func (*AddListValueRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{12} -} - -func (x *AddListValueRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AddListValueRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type RemoveListValueRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The name of the List to remove a value from. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *RemoveListValueRequest) Reset() { - *x = RemoveListValueRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_alpha_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RemoveListValueRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RemoveListValueRequest) ProtoMessage() {} - -func (x *RemoveListValueRequest) ProtoReflect() protoreflect.Message { - mi := &file_alpha_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RemoveListValueRequest.ProtoReflect.Descriptor instead. -func (*RemoveListValueRequest) Descriptor() ([]byte, []int) { - return file_alpha_proto_rawDescGZIP(), []int{13} -} - -func (x *RemoveListValueRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *RemoveListValueRequest) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - var File_alpha_proto protoreflect.FileDescriptor var file_alpha_proto_rawDesc = []byte{ @@ -819,213 +290,76 @@ var file_alpha_proto_rawDesc = []byte{ 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, - 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, - 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1d, - 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, - 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x21, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x42, 0x0d, 0x92, 0x41, 0x0a, 0xa2, 0x02, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, - 0x61, 0x6e, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x22, 0x26, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, - 0x22, 0x22, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, - 0x6c, 0x69, 0x73, 0x74, 0x22, 0x7c, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, - 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, - 0x61, 0x63, 0x69, 0x74, 0x79, 0x3a, 0x2b, 0xea, 0x41, 0x28, 0x0a, 0x12, 0x61, 0x67, 0x6f, 0x6e, - 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x12, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x7d, 0x22, 0x88, 0x02, 0x0a, 0x14, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x31, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x69, 0x66, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x69, 0x66, 0x66, 0x3a, 0x52, 0xea, 0x41, 0x4f, 0x0a, 0x1f, - 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x2c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x7d, 0x22, 0x43, 0x0a, - 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x1a, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x14, 0x0a, 0x12, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x87, 0x01, 0x0a, 0x14, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x61, 0x67, 0x6f, - 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x27, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x21, 0x0a, 0x1f, - 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, - 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x72, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x3a, 0x22, 0xea, 0x41, 0x1f, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, - 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0c, 0x6c, 0x69, 0x73, - 0x74, 0x73, 0x2f, 0x7b, 0x6c, 0x69, 0x73, 0x74, 0x7d, 0x22, 0x3d, 0x0a, 0x0e, 0x47, 0x65, 0x74, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xe0, 0x41, 0x02, 0xfa, 0x41, - 0x11, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x47, - 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, - 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x17, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, - 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x0a, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x5d, 0x0a, 0x13, 0x41, 0x64, 0x64, - 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x2b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, - 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, - 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, - 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x60, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x17, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, - 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, - 0xe0, 0x41, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x32, 0x82, 0x0d, 0x0a, 0x03, 0x53, - 0x44, 0x4b, 0x12, 0x6d, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, - 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, - 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x01, - 0x2a, 0x12, 0x73, 0x0a, 0x10, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, - 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, - 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, - 0x6c, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, 0x18, 0x2f, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x70, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1b, 0x2e, 0x61, 0x67, - 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, - 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x1a, 0x16, 0x2f, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x61, 0x70, - 0x61, 0x63, 0x69, 0x74, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x6d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1b, 0x2e, - 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x61, 0x67, 0x6f, - 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, - 0x16, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, - 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, + 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, + 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1d, 0x0a, 0x05, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x29, 0x0a, 0x04, 0x42, 0x6f, 0x6f, + 0x6c, 0x12, 0x21, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x42, + 0x0d, 0x92, 0x41, 0x0a, 0xa2, 0x02, 0x07, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x04, + 0x62, 0x6f, 0x6f, 0x6c, 0x22, 0x26, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x22, 0x22, 0x0a, 0x0c, + 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, + 0x32, 0xa9, 0x06, 0x0a, 0x03, 0x53, 0x44, 0x4b, 0x12, 0x6d, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x12, 0x13, 0x2f, 0x61, 0x6c, - 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x7b, 0x0a, 0x11, 0x49, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, - 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, - 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, - 0x6c, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x65, 0x64, 0x2f, 0x7b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x7d, 0x12, 0x77, 0x0a, - 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x22, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, - 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, - 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x7e, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x12, 0x27, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, - 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x22, 0x28, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xda, - 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0xbf, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x2a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, - 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x22, 0x63, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x46, 0x32, 0x2e, 0x2f, 0x76, 0x31, - 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x2f, - 0x7b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x14, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0xda, 0x41, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x72, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x24, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, - 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, + 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, 0x7b, - 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x8f, 0x01, 0x0a, - 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x2e, 0x61, 0x67, + 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x22, 0x15, 0x2f, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x73, 0x0a, 0x10, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1e, 0x2e, 0x61, 0x67, + 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, + 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, + 0x18, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x70, 0x0a, 0x11, + 0x53, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, + 0x79, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, + 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x1b, + 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, + 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1b, 0x1a, 0x16, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3a, 0x01, 0x2a, 0x12, 0x6d, + 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x61, 0x70, 0x61, 0x63, + 0x69, 0x74, 0x79, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, + 0x1a, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, + 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x1e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x67, 0x0a, + 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, + 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x61, + 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x15, 0x12, 0x13, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x7b, 0x0a, 0x11, 0x49, 0x73, 0x50, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x22, 0x3c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x32, 0x1b, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x6c, 0x69, 0x73, 0x74, 0x2e, - 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0xda, 0x41, 0x10, 0x6c, 0x69, - 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x12, 0x81, - 0x01, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x29, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, - 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, + 0x68, 0x61, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x1a, 0x1a, 0x2e, 0x61, 0x67, + 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, + 0x22, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x63, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x2f, 0x7b, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x49, 0x44, 0x7d, 0x12, 0x77, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, - 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x22, 0x1f, - 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, - 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x01, 0x2a, 0x12, 0x8a, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x73, - 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2c, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, - 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, - 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x22, 0x22, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, - 0x3a, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x01, 0x2a, 0x42, - 0x53, 0x5a, 0x07, 0x2e, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x92, 0x41, 0x47, 0x12, 0x1e, 0x0a, - 0x0b, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, 0x01, 0x01, - 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, - 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, - 0x6a, 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x22, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x50, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x1f, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2f, 0x70, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x42, 0x53, 0x5a, 0x07, + 0x2e, 0x2f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x92, 0x41, 0x47, 0x12, 0x1e, 0x0a, 0x0b, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, 0x01, 0x01, 0x32, 0x10, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, + 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1040,62 +374,34 @@ func file_alpha_proto_rawDescGZIP() []byte { return file_alpha_proto_rawDescData } -var file_alpha_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_alpha_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_alpha_proto_goTypes = []interface{}{ - (*Empty)(nil), // 0: agones.dev.sdk.alpha.Empty - (*Count)(nil), // 1: agones.dev.sdk.alpha.Count - (*Bool)(nil), // 2: agones.dev.sdk.alpha.Bool - (*PlayerID)(nil), // 3: agones.dev.sdk.alpha.PlayerID - (*PlayerIDList)(nil), // 4: agones.dev.sdk.alpha.PlayerIDList - (*Counter)(nil), // 5: agones.dev.sdk.alpha.Counter - (*CounterUpdateRequest)(nil), // 6: agones.dev.sdk.alpha.CounterUpdateRequest - (*GetCounterRequest)(nil), // 7: agones.dev.sdk.alpha.GetCounterRequest - (*UpdateCounterRequest)(nil), // 8: agones.dev.sdk.alpha.UpdateCounterRequest - (*List)(nil), // 9: agones.dev.sdk.alpha.List - (*GetListRequest)(nil), // 10: agones.dev.sdk.alpha.GetListRequest - (*UpdateListRequest)(nil), // 11: agones.dev.sdk.alpha.UpdateListRequest - (*AddListValueRequest)(nil), // 12: agones.dev.sdk.alpha.AddListValueRequest - (*RemoveListValueRequest)(nil), // 13: agones.dev.sdk.alpha.RemoveListValueRequest - (*wrapperspb.Int64Value)(nil), // 14: google.protobuf.Int64Value - (*fieldmaskpb.FieldMask)(nil), // 15: google.protobuf.FieldMask + (*Empty)(nil), // 0: agones.dev.sdk.alpha.Empty + (*Count)(nil), // 1: agones.dev.sdk.alpha.Count + (*Bool)(nil), // 2: agones.dev.sdk.alpha.Bool + (*PlayerID)(nil), // 3: agones.dev.sdk.alpha.PlayerID + (*PlayerIDList)(nil), // 4: agones.dev.sdk.alpha.PlayerIDList } var file_alpha_proto_depIdxs = []int32{ - 14, // 0: agones.dev.sdk.alpha.CounterUpdateRequest.count:type_name -> google.protobuf.Int64Value - 14, // 1: agones.dev.sdk.alpha.CounterUpdateRequest.capacity:type_name -> google.protobuf.Int64Value - 6, // 2: agones.dev.sdk.alpha.UpdateCounterRequest.counterUpdateRequest:type_name -> agones.dev.sdk.alpha.CounterUpdateRequest - 9, // 3: agones.dev.sdk.alpha.UpdateListRequest.list:type_name -> agones.dev.sdk.alpha.List - 15, // 4: agones.dev.sdk.alpha.UpdateListRequest.update_mask:type_name -> google.protobuf.FieldMask - 3, // 5: agones.dev.sdk.alpha.SDK.PlayerConnect:input_type -> agones.dev.sdk.alpha.PlayerID - 3, // 6: agones.dev.sdk.alpha.SDK.PlayerDisconnect:input_type -> agones.dev.sdk.alpha.PlayerID - 1, // 7: agones.dev.sdk.alpha.SDK.SetPlayerCapacity:input_type -> agones.dev.sdk.alpha.Count - 0, // 8: agones.dev.sdk.alpha.SDK.GetPlayerCapacity:input_type -> agones.dev.sdk.alpha.Empty - 0, // 9: agones.dev.sdk.alpha.SDK.GetPlayerCount:input_type -> agones.dev.sdk.alpha.Empty - 3, // 10: agones.dev.sdk.alpha.SDK.IsPlayerConnected:input_type -> agones.dev.sdk.alpha.PlayerID - 0, // 11: agones.dev.sdk.alpha.SDK.GetConnectedPlayers:input_type -> agones.dev.sdk.alpha.Empty - 7, // 12: agones.dev.sdk.alpha.SDK.GetCounter:input_type -> agones.dev.sdk.alpha.GetCounterRequest - 8, // 13: agones.dev.sdk.alpha.SDK.UpdateCounter:input_type -> agones.dev.sdk.alpha.UpdateCounterRequest - 10, // 14: agones.dev.sdk.alpha.SDK.GetList:input_type -> agones.dev.sdk.alpha.GetListRequest - 11, // 15: agones.dev.sdk.alpha.SDK.UpdateList:input_type -> agones.dev.sdk.alpha.UpdateListRequest - 12, // 16: agones.dev.sdk.alpha.SDK.AddListValue:input_type -> agones.dev.sdk.alpha.AddListValueRequest - 13, // 17: agones.dev.sdk.alpha.SDK.RemoveListValue:input_type -> agones.dev.sdk.alpha.RemoveListValueRequest - 2, // 18: agones.dev.sdk.alpha.SDK.PlayerConnect:output_type -> agones.dev.sdk.alpha.Bool - 2, // 19: agones.dev.sdk.alpha.SDK.PlayerDisconnect:output_type -> agones.dev.sdk.alpha.Bool - 0, // 20: agones.dev.sdk.alpha.SDK.SetPlayerCapacity:output_type -> agones.dev.sdk.alpha.Empty - 1, // 21: agones.dev.sdk.alpha.SDK.GetPlayerCapacity:output_type -> agones.dev.sdk.alpha.Count - 1, // 22: agones.dev.sdk.alpha.SDK.GetPlayerCount:output_type -> agones.dev.sdk.alpha.Count - 2, // 23: agones.dev.sdk.alpha.SDK.IsPlayerConnected:output_type -> agones.dev.sdk.alpha.Bool - 4, // 24: agones.dev.sdk.alpha.SDK.GetConnectedPlayers:output_type -> agones.dev.sdk.alpha.PlayerIDList - 5, // 25: agones.dev.sdk.alpha.SDK.GetCounter:output_type -> agones.dev.sdk.alpha.Counter - 5, // 26: agones.dev.sdk.alpha.SDK.UpdateCounter:output_type -> agones.dev.sdk.alpha.Counter - 9, // 27: agones.dev.sdk.alpha.SDK.GetList:output_type -> agones.dev.sdk.alpha.List - 9, // 28: agones.dev.sdk.alpha.SDK.UpdateList:output_type -> agones.dev.sdk.alpha.List - 9, // 29: agones.dev.sdk.alpha.SDK.AddListValue:output_type -> agones.dev.sdk.alpha.List - 9, // 30: agones.dev.sdk.alpha.SDK.RemoveListValue:output_type -> agones.dev.sdk.alpha.List - 18, // [18:31] is the sub-list for method output_type - 5, // [5:18] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 3, // 0: agones.dev.sdk.alpha.SDK.PlayerConnect:input_type -> agones.dev.sdk.alpha.PlayerID + 3, // 1: agones.dev.sdk.alpha.SDK.PlayerDisconnect:input_type -> agones.dev.sdk.alpha.PlayerID + 1, // 2: agones.dev.sdk.alpha.SDK.SetPlayerCapacity:input_type -> agones.dev.sdk.alpha.Count + 0, // 3: agones.dev.sdk.alpha.SDK.GetPlayerCapacity:input_type -> agones.dev.sdk.alpha.Empty + 0, // 4: agones.dev.sdk.alpha.SDK.GetPlayerCount:input_type -> agones.dev.sdk.alpha.Empty + 3, // 5: agones.dev.sdk.alpha.SDK.IsPlayerConnected:input_type -> agones.dev.sdk.alpha.PlayerID + 0, // 6: agones.dev.sdk.alpha.SDK.GetConnectedPlayers:input_type -> agones.dev.sdk.alpha.Empty + 2, // 7: agones.dev.sdk.alpha.SDK.PlayerConnect:output_type -> agones.dev.sdk.alpha.Bool + 2, // 8: agones.dev.sdk.alpha.SDK.PlayerDisconnect:output_type -> agones.dev.sdk.alpha.Bool + 0, // 9: agones.dev.sdk.alpha.SDK.SetPlayerCapacity:output_type -> agones.dev.sdk.alpha.Empty + 1, // 10: agones.dev.sdk.alpha.SDK.GetPlayerCapacity:output_type -> agones.dev.sdk.alpha.Count + 1, // 11: agones.dev.sdk.alpha.SDK.GetPlayerCount:output_type -> agones.dev.sdk.alpha.Count + 2, // 12: agones.dev.sdk.alpha.SDK.IsPlayerConnected:output_type -> agones.dev.sdk.alpha.Bool + 4, // 13: agones.dev.sdk.alpha.SDK.GetConnectedPlayers:output_type -> agones.dev.sdk.alpha.PlayerIDList + 7, // [7:14] is the sub-list for method output_type + 0, // [0:7] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_alpha_proto_init() } @@ -1164,114 +470,6 @@ func file_alpha_proto_init() { return nil } } - file_alpha_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Counter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CounterUpdateRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetCounterRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCounterRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*List); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddListValueRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_alpha_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RemoveListValueRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1279,7 +477,7 @@ func file_alpha_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_alpha_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/sdk/alpha/alpha.pb.gw.go b/pkg/sdk/alpha/alpha.pb.gw.go index 38d4ed34a5..4cebb86351 100644 --- a/pkg/sdk/alpha/alpha.pb.gw.go +++ b/pkg/sdk/alpha/alpha.pb.gw.go @@ -254,414 +254,6 @@ func local_request_SDK_GetConnectedPlayers_0(ctx context.Context, marshaler runt } -func request_SDK_GetCounter_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetCounterRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := client.GetCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SDK_GetCounter_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetCounterRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := server.GetCounter(ctx, &protoReq) - return msg, metadata, err - -} - -func request_SDK_UpdateCounter_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateCounterRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.CounterUpdateRequest); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["counterUpdateRequest.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "counterUpdateRequest.name") - } - - err = runtime.PopulateFieldFromPath(&protoReq, "counterUpdateRequest.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "counterUpdateRequest.name", err) - } - - msg, err := client.UpdateCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SDK_UpdateCounter_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateCounterRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.CounterUpdateRequest); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["counterUpdateRequest.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "counterUpdateRequest.name") - } - - err = runtime.PopulateFieldFromPath(&protoReq, "counterUpdateRequest.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "counterUpdateRequest.name", err) - } - - msg, err := server.UpdateCounter(ctx, &protoReq) - return msg, metadata, err - -} - -func request_SDK_GetList_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetListRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := client.GetList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SDK_GetList_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetListRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := server.GetList(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_SDK_UpdateList_0 = &utilities.DoubleArray{Encoding: map[string]int{"list": 0, "name": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}} -) - -func request_SDK_UpdateList_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateListRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.List); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.List); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["list.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "list.name") - } - - err = runtime.PopulateFieldFromPath(&protoReq, "list.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "list.name", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SDK_UpdateList_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.UpdateList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SDK_UpdateList_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateListRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.List); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { - if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.List); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } else { - protoReq.UpdateMask = fieldMask - } - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["list.name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "list.name") - } - - err = runtime.PopulateFieldFromPath(&protoReq, "list.name", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "list.name", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SDK_UpdateList_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UpdateList(ctx, &protoReq) - return msg, metadata, err - -} - -func request_SDK_AddListValue_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AddListValueRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := client.AddListValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SDK_AddListValue_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq AddListValueRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := server.AddListValue(ctx, &protoReq) - return msg, metadata, err - -} - -func request_SDK_RemoveListValue_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RemoveListValueRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := client.RemoveListValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SDK_RemoveListValue_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq RemoveListValueRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["name"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") - } - - protoReq.Name, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) - } - - msg, err := server.RemoveListValue(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterSDKHandlerServer registers the http handlers for service SDK to "mux". // UnaryRPC :call SDKServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -843,156 +435,6 @@ func RegisterSDKHandlerServer(ctx context.Context, mux *runtime.ServeMux, server }) - mux.Handle("GET", pattern_SDK_GetCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetCounter", runtime.WithHTTPPathPattern("/v1alpha1/counters/{name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_GetCounter_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_GetCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("PATCH", pattern_SDK_UpdateCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/UpdateCounter", runtime.WithHTTPPathPattern("/v1alpha1/counters/{counterUpdateRequest.name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_UpdateCounter_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_UpdateCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SDK_GetList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetList", runtime.WithHTTPPathPattern("/v1alpha1/lists/{name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_GetList_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_GetList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("PATCH", pattern_SDK_UpdateList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/UpdateList", runtime.WithHTTPPathPattern("/v1alpha1/lists/{list.name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_UpdateList_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_UpdateList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_SDK_AddListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/AddListValue", runtime.WithHTTPPathPattern("/v1alpha1/lists/{name}:addValue")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_AddListValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_AddListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_SDK_RemoveListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/RemoveListValue", runtime.WithHTTPPathPattern("/v1alpha1/lists/{name}:removeValue")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SDK_RemoveListValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_RemoveListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -1188,138 +630,6 @@ func RegisterSDKHandlerClient(ctx context.Context, mux *runtime.ServeMux, client }) - mux.Handle("GET", pattern_SDK_GetCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetCounter", runtime.WithHTTPPathPattern("/v1alpha1/counters/{name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_GetCounter_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_GetCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("PATCH", pattern_SDK_UpdateCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/UpdateCounter", runtime.WithHTTPPathPattern("/v1alpha1/counters/{counterUpdateRequest.name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_UpdateCounter_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_UpdateCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_SDK_GetList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/GetList", runtime.WithHTTPPathPattern("/v1alpha1/lists/{name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_GetList_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_GetList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("PATCH", pattern_SDK_UpdateList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/UpdateList", runtime.WithHTTPPathPattern("/v1alpha1/lists/{list.name}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_UpdateList_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_UpdateList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_SDK_AddListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/AddListValue", runtime.WithHTTPPathPattern("/v1alpha1/lists/{name}:addValue")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_AddListValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_AddListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_SDK_RemoveListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - var err error - var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.alpha.SDK/RemoveListValue", runtime.WithHTTPPathPattern("/v1alpha1/lists/{name}:removeValue")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SDK_RemoveListValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_SDK_RemoveListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -1337,18 +647,6 @@ var ( 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"}, "")) pattern_SDK_GetConnectedPlayers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"alpha", "player", "connected"}, "")) - - pattern_SDK_GetCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "counters", "name"}, "")) - - pattern_SDK_UpdateCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "counters", "counterUpdateRequest.name"}, "")) - - pattern_SDK_GetList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "lists", "name"}, "")) - - pattern_SDK_UpdateList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "lists", "list.name"}, "")) - - pattern_SDK_AddListValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "lists", "name"}, "addValue")) - - pattern_SDK_RemoveListValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "lists", "name"}, "removeValue")) ) var ( @@ -1365,16 +663,4 @@ var ( forward_SDK_IsPlayerConnected_0 = runtime.ForwardResponseMessage forward_SDK_GetConnectedPlayers_0 = runtime.ForwardResponseMessage - - forward_SDK_GetCounter_0 = runtime.ForwardResponseMessage - - forward_SDK_UpdateCounter_0 = runtime.ForwardResponseMessage - - forward_SDK_GetList_0 = runtime.ForwardResponseMessage - - forward_SDK_UpdateList_0 = runtime.ForwardResponseMessage - - forward_SDK_AddListValue_0 = runtime.ForwardResponseMessage - - forward_SDK_RemoveListValue_0 = runtime.ForwardResponseMessage ) diff --git a/pkg/sdk/alpha/alpha_grpc.pb.go b/pkg/sdk/alpha/alpha_grpc.pb.go index bf5dbd000f..c4ea827209 100644 --- a/pkg/sdk/alpha/alpha_grpc.pb.go +++ b/pkg/sdk/alpha/alpha_grpc.pb.go @@ -91,27 +91,6 @@ type SDKClient interface { // // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. GetConnectedPlayers(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*PlayerIDList, error) - // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. - GetCounter(ctx context.Context, in *GetCounterRequest, opts ...grpc.CallOption) (*Counter, error) - // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). - // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. - UpdateCounter(ctx context.Context, in *UpdateCounterRequest, opts ...grpc.CallOption) (*Counter, error) - // Gets a List. Returns NOT_FOUND if the List does not exist. - GetList(ctx context.Context, in *GetListRequest, opts ...grpc.CallOption) (*List, error) - // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). - // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** - // Use AddListValue() or RemoveListValue() for modifying the List.Values field. - // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. - // If a field mask path(s) is specified, but the value is not set in the request List object, - // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). - UpdateList(ctx context.Context, in *UpdateListRequest, opts ...grpc.CallOption) (*List, error) - // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns ALREADY_EXISTS if the value is already in the List. - // Returns OUT_OF_RANGE if the List is already at Capacity. - AddListValue(ctx context.Context, in *AddListValueRequest, opts ...grpc.CallOption) (*List, error) - // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns NOT_FOUND if the value is not in the List. - RemoveListValue(ctx context.Context, in *RemoveListValueRequest, opts ...grpc.CallOption) (*List, error) } type sDKClient struct { @@ -185,60 +164,6 @@ func (c *sDKClient) GetConnectedPlayers(ctx context.Context, in *Empty, opts ... return out, nil } -func (c *sDKClient) GetCounter(ctx context.Context, in *GetCounterRequest, opts ...grpc.CallOption) (*Counter, error) { - out := new(Counter) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetCounter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) UpdateCounter(ctx context.Context, in *UpdateCounterRequest, opts ...grpc.CallOption) (*Counter, error) { - out := new(Counter) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/UpdateCounter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) GetList(ctx context.Context, in *GetListRequest, opts ...grpc.CallOption) (*List, error) { - out := new(List) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/GetList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) UpdateList(ctx context.Context, in *UpdateListRequest, opts ...grpc.CallOption) (*List, error) { - out := new(List) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/UpdateList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) AddListValue(ctx context.Context, in *AddListValueRequest, opts ...grpc.CallOption) (*List, error) { - out := new(List) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/AddListValue", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *sDKClient) RemoveListValue(ctx context.Context, in *RemoveListValueRequest, opts ...grpc.CallOption) (*List, error) { - out := new(List) - err := c.cc.Invoke(ctx, "/agones.dev.sdk.alpha.SDK/RemoveListValue", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // SDKServer is the server API for SDK service. // All implementations should embed UnimplementedSDKServer // for forward compatibility @@ -296,27 +221,6 @@ type SDKServer interface { // // If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. GetConnectedPlayers(context.Context, *Empty) (*PlayerIDList, error) - // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. - GetCounter(context.Context, *GetCounterRequest) (*Counter, error) - // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). - // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. - UpdateCounter(context.Context, *UpdateCounterRequest) (*Counter, error) - // Gets a List. Returns NOT_FOUND if the List does not exist. - GetList(context.Context, *GetListRequest) (*List, error) - // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). - // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** - // Use AddListValue() or RemoveListValue() for modifying the List.Values field. - // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. - // If a field mask path(s) is specified, but the value is not set in the request List object, - // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). - UpdateList(context.Context, *UpdateListRequest) (*List, error) - // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns ALREADY_EXISTS if the value is already in the List. - // Returns OUT_OF_RANGE if the List is already at Capacity. - AddListValue(context.Context, *AddListValueRequest) (*List, error) - // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns NOT_FOUND if the value is not in the List. - RemoveListValue(context.Context, *RemoveListValueRequest) (*List, error) } // UnimplementedSDKServer should be embedded to have forward compatible implementations. @@ -344,24 +248,6 @@ func (UnimplementedSDKServer) IsPlayerConnected(context.Context, *PlayerID) (*Bo func (UnimplementedSDKServer) GetConnectedPlayers(context.Context, *Empty) (*PlayerIDList, error) { return nil, status.Errorf(codes.Unimplemented, "method GetConnectedPlayers not implemented") } -func (UnimplementedSDKServer) GetCounter(context.Context, *GetCounterRequest) (*Counter, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCounter not implemented") -} -func (UnimplementedSDKServer) UpdateCounter(context.Context, *UpdateCounterRequest) (*Counter, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateCounter not implemented") -} -func (UnimplementedSDKServer) GetList(context.Context, *GetListRequest) (*List, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetList not implemented") -} -func (UnimplementedSDKServer) UpdateList(context.Context, *UpdateListRequest) (*List, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateList not implemented") -} -func (UnimplementedSDKServer) AddListValue(context.Context, *AddListValueRequest) (*List, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddListValue not implemented") -} -func (UnimplementedSDKServer) RemoveListValue(context.Context, *RemoveListValueRequest) (*List, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveListValue not implemented") -} // UnsafeSDKServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SDKServer will @@ -500,114 +386,6 @@ func _SDK_GetConnectedPlayers_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _SDK_GetCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCounterRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).GetCounter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/GetCounter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).GetCounter(ctx, req.(*GetCounterRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_UpdateCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateCounterRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).UpdateCounter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/UpdateCounter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).UpdateCounter(ctx, req.(*UpdateCounterRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_GetList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).GetList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/GetList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).GetList(ctx, req.(*GetListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_UpdateList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).UpdateList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/UpdateList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).UpdateList(ctx, req.(*UpdateListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_AddListValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AddListValueRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).AddListValue(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/AddListValue", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).AddListValue(ctx, req.(*AddListValueRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _SDK_RemoveListValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RemoveListValueRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SDKServer).RemoveListValue(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/agones.dev.sdk.alpha.SDK/RemoveListValue", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SDKServer).RemoveListValue(ctx, req.(*RemoveListValueRequest)) - } - return interceptor(ctx, in, info, handler) -} - // SDK_ServiceDesc is the grpc.ServiceDesc for SDK service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -643,30 +421,6 @@ var SDK_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetConnectedPlayers", Handler: _SDK_GetConnectedPlayers_Handler, }, - { - MethodName: "GetCounter", - Handler: _SDK_GetCounter_Handler, - }, - { - MethodName: "UpdateCounter", - Handler: _SDK_UpdateCounter_Handler, - }, - { - MethodName: "GetList", - Handler: _SDK_GetList_Handler, - }, - { - MethodName: "UpdateList", - Handler: _SDK_UpdateList_Handler, - }, - { - MethodName: "AddListValue", - Handler: _SDK_AddListValue_Handler, - }, - { - MethodName: "RemoveListValue", - Handler: _SDK_RemoveListValue_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "alpha.proto", diff --git a/pkg/sdk/beta/beta.pb.go b/pkg/sdk/beta/beta.pb.go index 2e6ba6318e..05caebb831 100644 --- a/pkg/sdk/beta/beta.pb.go +++ b/pkg/sdk/beta/beta.pb.go @@ -37,11 +37,15 @@ package beta import ( reflect "reflect" + sync "sync" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/known/emptypb" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + wrapperspb "google.golang.org/protobuf/types/known/wrapperspb" ) const ( @@ -51,6 +55,571 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// I am Empty +type Empty struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Empty) Reset() { + *x = Empty{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{0} +} + +// A representation of a Counter. +type Counter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the Counter + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The current count of the Counter + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + // The maximum capacity of the Counter + Capacity int64 `protobuf:"varint,3,opt,name=capacity,proto3" json:"capacity,omitempty"` +} + +func (x *Counter) Reset() { + *x = Counter{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Counter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Counter) ProtoMessage() {} + +func (x *Counter) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Counter.ProtoReflect.Descriptor instead. +func (*Counter) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{1} +} + +func (x *Counter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Counter) GetCount() int64 { + if x != nil { + return x.Count + } + return 0 +} + +func (x *Counter) GetCapacity() int64 { + if x != nil { + return x.Capacity + } + return 0 +} + +// A representation of a Counter Update Request. +type CounterUpdateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the Counter to update + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The value to set the Counter Count + Count *wrapperspb.Int64Value `protobuf:"bytes,2,opt,name=count,proto3" json:"count,omitempty"` + // The value to set the Counter Capacity + Capacity *wrapperspb.Int64Value `protobuf:"bytes,3,opt,name=capacity,proto3" json:"capacity,omitempty"` + // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement + // (negative), 0 if a CountSet or CapacitySet request + CountDiff int64 `protobuf:"varint,4,opt,name=countDiff,proto3" json:"countDiff,omitempty"` +} + +func (x *CounterUpdateRequest) Reset() { + *x = CounterUpdateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CounterUpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CounterUpdateRequest) ProtoMessage() {} + +func (x *CounterUpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CounterUpdateRequest.ProtoReflect.Descriptor instead. +func (*CounterUpdateRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{2} +} + +func (x *CounterUpdateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CounterUpdateRequest) GetCount() *wrapperspb.Int64Value { + if x != nil { + return x.Count + } + return nil +} + +func (x *CounterUpdateRequest) GetCapacity() *wrapperspb.Int64Value { + if x != nil { + return x.Capacity + } + return nil +} + +func (x *CounterUpdateRequest) GetCountDiff() int64 { + if x != nil { + return x.CountDiff + } + return 0 +} + +type GetCounterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the Counter to get + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetCounterRequest) Reset() { + *x = GetCounterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetCounterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCounterRequest) ProtoMessage() {} + +func (x *GetCounterRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCounterRequest.ProtoReflect.Descriptor instead. +func (*GetCounterRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{3} +} + +func (x *GetCounterRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UpdateCounterRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The requested update to make to the Counter + CounterUpdateRequest *CounterUpdateRequest `protobuf:"bytes,1,opt,name=counterUpdateRequest,proto3" json:"counterUpdateRequest,omitempty"` +} + +func (x *UpdateCounterRequest) Reset() { + *x = UpdateCounterRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateCounterRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateCounterRequest) ProtoMessage() {} + +func (x *UpdateCounterRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateCounterRequest.ProtoReflect.Descriptor instead. +func (*UpdateCounterRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateCounterRequest) GetCounterUpdateRequest() *CounterUpdateRequest { + if x != nil { + return x.CounterUpdateRequest + } + return nil +} + +// A representation of a List. +type List struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the List + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The maximum capacity of the List + Capacity int64 `protobuf:"varint,2,opt,name=capacity,proto3" json:"capacity,omitempty"` + // The array of items in the List ["v1", "v2", …] + Values []string `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"` +} + +func (x *List) Reset() { + *x = List{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *List) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*List) ProtoMessage() {} + +func (x *List) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use List.ProtoReflect.Descriptor instead. +func (*List) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{5} +} + +func (x *List) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *List) GetCapacity() int64 { + if x != nil { + return x.Capacity + } + return 0 +} + +func (x *List) GetValues() []string { + if x != nil { + return x.Values + } + return nil +} + +type GetListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the List to get + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetListRequest) Reset() { + *x = GetListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetListRequest) ProtoMessage() {} + +func (x *GetListRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetListRequest.ProtoReflect.Descriptor instead. +func (*GetListRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{6} +} + +func (x *GetListRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type UpdateListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The List to update + List *List `protobuf:"bytes,1,opt,name=list,proto3" json:"list,omitempty"` + // Required. Mask (list) of fields to update. + // Fields are specified relative to the List + // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateListRequest) Reset() { + *x = UpdateListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateListRequest) ProtoMessage() {} + +func (x *UpdateListRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateListRequest.ProtoReflect.Descriptor instead. +func (*UpdateListRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateListRequest) GetList() *List { + if x != nil { + return x.List + } + return nil +} + +func (x *UpdateListRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type AddListValueRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the List to add a value to. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *AddListValueRequest) Reset() { + *x = AddListValueRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddListValueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddListValueRequest) ProtoMessage() {} + +func (x *AddListValueRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddListValueRequest.ProtoReflect.Descriptor instead. +func (*AddListValueRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{8} +} + +func (x *AddListValueRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AddListValueRequest) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +type RemoveListValueRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the List to remove a value from. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *RemoveListValueRequest) Reset() { + *x = RemoveListValueRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_beta_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveListValueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveListValueRequest) ProtoMessage() {} + +func (x *RemoveListValueRequest) ProtoReflect() protoreflect.Message { + mi := &file_beta_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveListValueRequest.ProtoReflect.Descriptor instead. +func (*RemoveListValueRequest) Descriptor() ([]byte, []int) { + return file_beta_proto_rawDescGZIP(), []int{9} +} + +func (x *RemoveListValueRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RemoveListValueRequest) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + var File_beta_proto protoreflect.FileDescriptor var file_beta_proto_rawDesc = []byte{ @@ -58,25 +627,204 @@ var file_beta_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, - 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, - 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, - 0x05, 0x0a, 0x03, 0x53, 0x44, 0x4b, 0x42, 0x51, 0x5a, 0x06, 0x2e, 0x2f, 0x62, 0x65, 0x74, 0x61, - 0x92, 0x41, 0x46, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x32, 0x0f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, - 0x65, 0x74, 0x2a, 0x01, 0x01, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var file_beta_proto_goTypes = []interface{}{} + 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, + 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, + 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x7c, 0x0a, 0x07, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x3a, 0x2b, 0xea, + 0x41, 0x28, 0x0a, 0x12, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x12, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, + 0x2f, 0x7b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x7d, 0x22, 0x88, 0x02, 0x0a, 0x14, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x63, 0x61, + 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x49, + 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, + 0x69, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x69, 0x66, 0x66, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x69, 0x66, + 0x66, 0x3a, 0x52, 0xea, 0x41, 0x4f, 0x0a, 0x1f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, + 0x65, 0x76, 0x2f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x7b, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x7d, 0x22, 0x43, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x14, + 0x0a, 0x12, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x14, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x86, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x42, 0x27, 0xe0, + 0x41, 0x02, 0xfa, 0x41, 0x21, 0x0a, 0x1f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x72, 0x0a, 0x04, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, + 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, + 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x3a, 0x22, 0xea, 0x41, + 0x1f, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x6c, 0x69, 0x73, 0x74, 0x7d, + 0x22, 0x3d, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x17, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, + 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x9d, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, + 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x17, + 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, 0x0a, 0x0f, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, + 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x40, 0x0a, + 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x42, 0x03, + 0xe0, 0x41, 0x02, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, + 0x5d, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, 0x0a, 0x0f, 0x61, 0x67, + 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x60, + 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xe0, 0x41, 0x02, 0xfa, 0x41, 0x11, 0x0a, 0x0f, + 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x32, 0xcb, 0x06, 0x0a, 0x03, 0x53, 0x44, 0x4b, 0x12, 0x7b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x26, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, + 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x47, 0x65, 0x74, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, + 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, + 0x62, 0x65, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x22, 0x27, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xda, 0x41, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0xbc, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x29, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, + 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, + 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x22, 0x62, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x45, 0x32, 0x2d, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x2f, 0x7b, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x14, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0xda, 0x41, 0x14, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x6f, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x23, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, + 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x22, + 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0xda, 0x41, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, + 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, + 0x74, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x32, + 0x1a, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, + 0x7b, 0x6c, 0x69, 0x73, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x04, 0x6c, 0x69, 0x73, + 0x74, 0xda, 0x41, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, + 0x6d, 0x61, 0x73, 0x6b, 0x12, 0x7e, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x12, 0x28, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, + 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x41, 0x64, 0x64, 0x4c, 0x69, + 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, + 0x62, 0x65, 0x74, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x23, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, + 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, 0x61, 0x64, 0x64, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x87, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, + 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2b, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, + 0x73, 0x2e, 0x64, 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, 0x67, 0x6f, 0x6e, 0x65, 0x73, 0x2e, 0x64, + 0x65, 0x76, 0x2e, 0x73, 0x64, 0x6b, 0x2e, 0x62, 0x65, 0x74, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x22, 0x21, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x3a, + 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x01, 0x2a, 0x42, 0x51, + 0x5a, 0x06, 0x2e, 0x2f, 0x62, 0x65, 0x74, 0x61, 0x92, 0x41, 0x46, 0x12, 0x1d, 0x0a, 0x0a, 0x62, + 0x65, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x0f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x2a, 0x01, 0x01, 0x32, 0x10, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, + 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_beta_proto_rawDescOnce sync.Once + file_beta_proto_rawDescData = file_beta_proto_rawDesc +) + +func file_beta_proto_rawDescGZIP() []byte { + file_beta_proto_rawDescOnce.Do(func() { + file_beta_proto_rawDescData = protoimpl.X.CompressGZIP(file_beta_proto_rawDescData) + }) + return file_beta_proto_rawDescData +} + +var file_beta_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_beta_proto_goTypes = []interface{}{ + (*Empty)(nil), // 0: agones.dev.sdk.beta.Empty + (*Counter)(nil), // 1: agones.dev.sdk.beta.Counter + (*CounterUpdateRequest)(nil), // 2: agones.dev.sdk.beta.CounterUpdateRequest + (*GetCounterRequest)(nil), // 3: agones.dev.sdk.beta.GetCounterRequest + (*UpdateCounterRequest)(nil), // 4: agones.dev.sdk.beta.UpdateCounterRequest + (*List)(nil), // 5: agones.dev.sdk.beta.List + (*GetListRequest)(nil), // 6: agones.dev.sdk.beta.GetListRequest + (*UpdateListRequest)(nil), // 7: agones.dev.sdk.beta.UpdateListRequest + (*AddListValueRequest)(nil), // 8: agones.dev.sdk.beta.AddListValueRequest + (*RemoveListValueRequest)(nil), // 9: agones.dev.sdk.beta.RemoveListValueRequest + (*wrapperspb.Int64Value)(nil), // 10: google.protobuf.Int64Value + (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask +} var file_beta_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 10, // 0: agones.dev.sdk.beta.CounterUpdateRequest.count:type_name -> google.protobuf.Int64Value + 10, // 1: agones.dev.sdk.beta.CounterUpdateRequest.capacity:type_name -> google.protobuf.Int64Value + 2, // 2: agones.dev.sdk.beta.UpdateCounterRequest.counterUpdateRequest:type_name -> agones.dev.sdk.beta.CounterUpdateRequest + 5, // 3: agones.dev.sdk.beta.UpdateListRequest.list:type_name -> agones.dev.sdk.beta.List + 11, // 4: agones.dev.sdk.beta.UpdateListRequest.update_mask:type_name -> google.protobuf.FieldMask + 3, // 5: agones.dev.sdk.beta.SDK.GetCounter:input_type -> agones.dev.sdk.beta.GetCounterRequest + 4, // 6: agones.dev.sdk.beta.SDK.UpdateCounter:input_type -> agones.dev.sdk.beta.UpdateCounterRequest + 6, // 7: agones.dev.sdk.beta.SDK.GetList:input_type -> agones.dev.sdk.beta.GetListRequest + 7, // 8: agones.dev.sdk.beta.SDK.UpdateList:input_type -> agones.dev.sdk.beta.UpdateListRequest + 8, // 9: agones.dev.sdk.beta.SDK.AddListValue:input_type -> agones.dev.sdk.beta.AddListValueRequest + 9, // 10: agones.dev.sdk.beta.SDK.RemoveListValue:input_type -> agones.dev.sdk.beta.RemoveListValueRequest + 1, // 11: agones.dev.sdk.beta.SDK.GetCounter:output_type -> agones.dev.sdk.beta.Counter + 1, // 12: agones.dev.sdk.beta.SDK.UpdateCounter:output_type -> agones.dev.sdk.beta.Counter + 5, // 13: agones.dev.sdk.beta.SDK.GetList:output_type -> agones.dev.sdk.beta.List + 5, // 14: agones.dev.sdk.beta.SDK.UpdateList:output_type -> agones.dev.sdk.beta.List + 5, // 15: agones.dev.sdk.beta.SDK.AddListValue:output_type -> agones.dev.sdk.beta.List + 5, // 16: agones.dev.sdk.beta.SDK.RemoveListValue:output_type -> agones.dev.sdk.beta.List + 11, // [11:17] is the sub-list for method output_type + 5, // [5:11] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_beta_proto_init() } @@ -84,18 +832,141 @@ func file_beta_proto_init() { if File_beta_proto != nil { return } + if !protoimpl.UnsafeEnabled { + file_beta_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Empty); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Counter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CounterUpdateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetCounterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateCounterRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*List); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddListValueRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_beta_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveListValueRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_beta_proto_rawDesc, NumEnums: 0, - NumMessages: 0, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, GoTypes: file_beta_proto_goTypes, DependencyIndexes: file_beta_proto_depIdxs, + MessageInfos: file_beta_proto_msgTypes, }.Build() File_beta_proto = out.File file_beta_proto_rawDesc = nil diff --git a/pkg/sdk/beta/beta.pb.gw.go b/pkg/sdk/beta/beta.pb.gw.go new file mode 100644 index 0000000000..3ca52d3c3c --- /dev/null +++ b/pkg/sdk/beta/beta.pb.gw.go @@ -0,0 +1,815 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: beta.proto + +/* +Package beta is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package beta + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_SDK_GetCounter_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCounterRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SDK_GetCounter_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetCounterRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetCounter(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SDK_UpdateCounter_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateCounterRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.CounterUpdateRequest); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["counterUpdateRequest.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "counterUpdateRequest.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "counterUpdateRequest.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "counterUpdateRequest.name", err) + } + + msg, err := client.UpdateCounter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SDK_UpdateCounter_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateCounterRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.CounterUpdateRequest); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["counterUpdateRequest.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "counterUpdateRequest.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "counterUpdateRequest.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "counterUpdateRequest.name", err) + } + + msg, err := server.UpdateCounter(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SDK_GetList_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetListRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SDK_GetList_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetListRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetList(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SDK_UpdateList_0 = &utilities.DoubleArray{Encoding: map[string]int{"list": 0, "name": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}} +) + +func request_SDK_UpdateList_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateListRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.List); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.List); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["list.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "list.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "list.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "list.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SDK_UpdateList_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateList(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SDK_UpdateList_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateListRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.List); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.List); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["list.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "list.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "list.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "list.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SDK_UpdateList_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateList(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SDK_AddListValue_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AddListValueRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.AddListValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SDK_AddListValue_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AddListValueRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.AddListValue(ctx, &protoReq) + return msg, metadata, err + +} + +func request_SDK_RemoveListValue_0(ctx context.Context, marshaler runtime.Marshaler, client SDKClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RemoveListValueRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.RemoveListValue(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SDK_RemoveListValue_0(ctx context.Context, marshaler runtime.Marshaler, server SDKServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RemoveListValueRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.RemoveListValue(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSDKHandlerServer registers the http handlers for service SDK to "mux". +// UnaryRPC :call SDKServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSDKHandlerFromEndpoint instead. +func RegisterSDKHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SDKServer) error { + + mux.Handle("GET", pattern_SDK_GetCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/GetCounter", runtime.WithHTTPPathPattern("/v1beta1/counters/{name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SDK_GetCounter_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_GetCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SDK_UpdateCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/UpdateCounter", runtime.WithHTTPPathPattern("/v1beta1/counters/{counterUpdateRequest.name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SDK_UpdateCounter_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_UpdateCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SDK_GetList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/GetList", runtime.WithHTTPPathPattern("/v1beta1/lists/{name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SDK_GetList_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_GetList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SDK_UpdateList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/UpdateList", runtime.WithHTTPPathPattern("/v1beta1/lists/{list.name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SDK_UpdateList_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_UpdateList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SDK_AddListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/AddListValue", runtime.WithHTTPPathPattern("/v1beta1/lists/{name}:addValue")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SDK_AddListValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_AddListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SDK_RemoveListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/RemoveListValue", runtime.WithHTTPPathPattern("/v1beta1/lists/{name}:removeValue")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SDK_RemoveListValue_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_RemoveListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSDKHandlerFromEndpoint is same as RegisterSDKHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSDKHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSDKHandler(ctx, mux, conn) +} + +// RegisterSDKHandler registers the http handlers for service SDK to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSDKHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSDKHandlerClient(ctx, mux, NewSDKClient(conn)) +} + +// RegisterSDKHandlerClient registers the http handlers for service SDK +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SDKClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SDKClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SDKClient" to call the correct interceptors. +func RegisterSDKHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SDKClient) error { + + mux.Handle("GET", pattern_SDK_GetCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/GetCounter", runtime.WithHTTPPathPattern("/v1beta1/counters/{name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SDK_GetCounter_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_GetCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SDK_UpdateCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/UpdateCounter", runtime.WithHTTPPathPattern("/v1beta1/counters/{counterUpdateRequest.name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SDK_UpdateCounter_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_UpdateCounter_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_SDK_GetList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/GetList", runtime.WithHTTPPathPattern("/v1beta1/lists/{name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SDK_GetList_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_GetList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_SDK_UpdateList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/UpdateList", runtime.WithHTTPPathPattern("/v1beta1/lists/{list.name}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SDK_UpdateList_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_UpdateList_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SDK_AddListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/AddListValue", runtime.WithHTTPPathPattern("/v1beta1/lists/{name}:addValue")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SDK_AddListValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_AddListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SDK_RemoveListValue_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/agones.dev.sdk.beta.SDK/RemoveListValue", runtime.WithHTTPPathPattern("/v1beta1/lists/{name}:removeValue")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SDK_RemoveListValue_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SDK_RemoveListValue_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_SDK_GetCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1beta1", "counters", "name"}, "")) + + pattern_SDK_UpdateCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1beta1", "counters", "counterUpdateRequest.name"}, "")) + + pattern_SDK_GetList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1beta1", "lists", "name"}, "")) + + pattern_SDK_UpdateList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1beta1", "lists", "list.name"}, "")) + + pattern_SDK_AddListValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1beta1", "lists", "name"}, "addValue")) + + pattern_SDK_RemoveListValue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1beta1", "lists", "name"}, "removeValue")) +) + +var ( + forward_SDK_GetCounter_0 = runtime.ForwardResponseMessage + + forward_SDK_UpdateCounter_0 = runtime.ForwardResponseMessage + + forward_SDK_GetList_0 = runtime.ForwardResponseMessage + + forward_SDK_UpdateList_0 = runtime.ForwardResponseMessage + + forward_SDK_AddListValue_0 = runtime.ForwardResponseMessage + + forward_SDK_RemoveListValue_0 = runtime.ForwardResponseMessage +) diff --git a/pkg/sdk/beta/beta_grpc.pb.go b/pkg/sdk/beta/beta_grpc.pb.go index 51c148269c..a52f32c956 100644 --- a/pkg/sdk/beta/beta_grpc.pb.go +++ b/pkg/sdk/beta/beta_grpc.pb.go @@ -22,7 +22,11 @@ package beta 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 @@ -34,6 +38,27 @@ const _ = grpc.SupportPackageIsVersion7 // // 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. type SDKClient interface { + // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. + GetCounter(ctx context.Context, in *GetCounterRequest, opts ...grpc.CallOption) (*Counter, error) + // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). + // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. + UpdateCounter(ctx context.Context, in *UpdateCounterRequest, opts ...grpc.CallOption) (*Counter, error) + // Gets a List. Returns NOT_FOUND if the List does not exist. + GetList(ctx context.Context, in *GetListRequest, opts ...grpc.CallOption) (*List, error) + // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). + // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** + // Use AddListValue() or RemoveListValue() for modifying the List.Values field. + // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. + // If a field mask path(s) is specified, but the value is not set in the request List object, + // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). + UpdateList(ctx context.Context, in *UpdateListRequest, opts ...grpc.CallOption) (*List, error) + // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns ALREADY_EXISTS if the value is already in the List. + // Returns OUT_OF_RANGE if the List is already at Capacity. + AddListValue(ctx context.Context, in *AddListValueRequest, opts ...grpc.CallOption) (*List, error) + // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns NOT_FOUND if the value is not in the List. + RemoveListValue(ctx context.Context, in *RemoveListValueRequest, opts ...grpc.CallOption) (*List, error) } type sDKClient struct { @@ -44,16 +69,110 @@ func NewSDKClient(cc grpc.ClientConnInterface) SDKClient { return &sDKClient{cc} } +func (c *sDKClient) GetCounter(ctx context.Context, in *GetCounterRequest, opts ...grpc.CallOption) (*Counter, error) { + out := new(Counter) + err := c.cc.Invoke(ctx, "/agones.dev.sdk.beta.SDK/GetCounter", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sDKClient) UpdateCounter(ctx context.Context, in *UpdateCounterRequest, opts ...grpc.CallOption) (*Counter, error) { + out := new(Counter) + err := c.cc.Invoke(ctx, "/agones.dev.sdk.beta.SDK/UpdateCounter", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sDKClient) GetList(ctx context.Context, in *GetListRequest, opts ...grpc.CallOption) (*List, error) { + out := new(List) + err := c.cc.Invoke(ctx, "/agones.dev.sdk.beta.SDK/GetList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sDKClient) UpdateList(ctx context.Context, in *UpdateListRequest, opts ...grpc.CallOption) (*List, error) { + out := new(List) + err := c.cc.Invoke(ctx, "/agones.dev.sdk.beta.SDK/UpdateList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sDKClient) AddListValue(ctx context.Context, in *AddListValueRequest, opts ...grpc.CallOption) (*List, error) { + out := new(List) + err := c.cc.Invoke(ctx, "/agones.dev.sdk.beta.SDK/AddListValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sDKClient) RemoveListValue(ctx context.Context, in *RemoveListValueRequest, opts ...grpc.CallOption) (*List, error) { + out := new(List) + err := c.cc.Invoke(ctx, "/agones.dev.sdk.beta.SDK/RemoveListValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // SDKServer is the server API for SDK service. // All implementations should embed UnimplementedSDKServer // for forward compatibility type SDKServer interface { + // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. + GetCounter(context.Context, *GetCounterRequest) (*Counter, error) + // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). + // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. + UpdateCounter(context.Context, *UpdateCounterRequest) (*Counter, error) + // Gets a List. Returns NOT_FOUND if the List does not exist. + GetList(context.Context, *GetListRequest) (*List, error) + // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). + // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** + // Use AddListValue() or RemoveListValue() for modifying the List.Values field. + // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. + // If a field mask path(s) is specified, but the value is not set in the request List object, + // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). + UpdateList(context.Context, *UpdateListRequest) (*List, error) + // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns ALREADY_EXISTS if the value is already in the List. + // Returns OUT_OF_RANGE if the List is already at Capacity. + AddListValue(context.Context, *AddListValueRequest) (*List, error) + // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns NOT_FOUND if the value is not in the List. + RemoveListValue(context.Context, *RemoveListValueRequest) (*List, error) } // UnimplementedSDKServer should be embedded to have forward compatible implementations. type UnimplementedSDKServer struct { } +func (UnimplementedSDKServer) GetCounter(context.Context, *GetCounterRequest) (*Counter, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCounter not implemented") +} +func (UnimplementedSDKServer) UpdateCounter(context.Context, *UpdateCounterRequest) (*Counter, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateCounter not implemented") +} +func (UnimplementedSDKServer) GetList(context.Context, *GetListRequest) (*List, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetList not implemented") +} +func (UnimplementedSDKServer) UpdateList(context.Context, *UpdateListRequest) (*List, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateList not implemented") +} +func (UnimplementedSDKServer) AddListValue(context.Context, *AddListValueRequest) (*List, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddListValue not implemented") +} +func (UnimplementedSDKServer) RemoveListValue(context.Context, *RemoveListValueRequest) (*List, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveListValue not implemented") +} + // UnsafeSDKServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SDKServer will // result in compilation errors. @@ -65,13 +184,146 @@ func RegisterSDKServer(s grpc.ServiceRegistrar, srv SDKServer) { s.RegisterService(&SDK_ServiceDesc, srv) } +func _SDK_GetCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCounterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SDKServer).GetCounter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/agones.dev.sdk.beta.SDK/GetCounter", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SDKServer).GetCounter(ctx, req.(*GetCounterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SDK_UpdateCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateCounterRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SDKServer).UpdateCounter(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/agones.dev.sdk.beta.SDK/UpdateCounter", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SDKServer).UpdateCounter(ctx, req.(*UpdateCounterRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SDK_GetList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SDKServer).GetList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/agones.dev.sdk.beta.SDK/GetList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SDKServer).GetList(ctx, req.(*GetListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SDK_UpdateList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SDKServer).UpdateList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/agones.dev.sdk.beta.SDK/UpdateList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SDKServer).UpdateList(ctx, req.(*UpdateListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SDK_AddListValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddListValueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SDKServer).AddListValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/agones.dev.sdk.beta.SDK/AddListValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SDKServer).AddListValue(ctx, req.(*AddListValueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SDK_RemoveListValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveListValueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SDKServer).RemoveListValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/agones.dev.sdk.beta.SDK/RemoveListValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SDKServer).RemoveListValue(ctx, req.(*RemoveListValueRequest)) + } + return interceptor(ctx, in, info, handler) +} + // SDK_ServiceDesc is the grpc.ServiceDesc for SDK service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var SDK_ServiceDesc = grpc.ServiceDesc{ ServiceName: "agones.dev.sdk.beta.SDK", HandlerType: (*SDKServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "beta.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "GetCounter", + Handler: _SDK_GetCounter_Handler, + }, + { + MethodName: "UpdateCounter", + Handler: _SDK_UpdateCounter_Handler, + }, + { + MethodName: "GetList", + Handler: _SDK_GetList_Handler, + }, + { + MethodName: "UpdateList", + Handler: _SDK_UpdateList_Handler, + }, + { + MethodName: "AddListValue", + Handler: _SDK_AddListValue_Handler, + }, + { + MethodName: "RemoveListValue", + Handler: _SDK_RemoveListValue_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "beta.proto", } diff --git a/pkg/sdk/sdk.pb.go b/pkg/sdk/sdk.pb.go index a2b99299de..fade8499ae 100644 --- a/pkg/sdk/sdk.pb.go +++ b/pkg/sdk/sdk.pb.go @@ -434,10 +434,10 @@ type GameServer_Status struct { // [Stage:Alpha] // [FeatureFlag:PlayerTracking] Players *GameServer_Status_PlayerStatus `protobuf:"bytes,4,opt,name=players,proto3" json:"players,omitempty"` - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] Counters map[string]*GameServer_Status_CounterStatus `protobuf:"bytes,5,rep,name=counters,proto3" json:"counters,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] Lists map[string]*GameServer_Status_ListStatus `protobuf:"bytes,6,rep,name=lists,proto3" json:"lists,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -769,7 +769,7 @@ func (x *GameServer_Status_PlayerStatus) GetIds() []string { return nil } -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] type GameServer_Status_CounterStatus struct { state protoimpl.MessageState @@ -826,7 +826,7 @@ func (x *GameServer_Status_CounterStatus) GetCapacity() int64 { return 0 } -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] type GameServer_Status_ListStatus struct { state protoimpl.MessageState diff --git a/pkg/sdkserver/localsdk.go b/pkg/sdkserver/localsdk.go index 4f5e8ce6ac..3b54a9fbd8 100644 --- a/pkg/sdkserver/localsdk.go +++ b/pkg/sdkserver/localsdk.go @@ -610,9 +610,9 @@ func (l *LocalSDKServer) GetPlayerCapacity(_ context.Context, _ *alpha.Empty) (* } // GetCounter returns a Counter. Returns not found if the counter does not exist. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (l *LocalSDKServer) GetCounter(ctx context.Context, in *alpha.GetCounterRequest) (*alpha.Counter, error) { +func (l *LocalSDKServer) GetCounter(ctx context.Context, in *beta.GetCounterRequest) (*beta.Counter, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -627,7 +627,7 @@ func (l *LocalSDKServer) GetCounter(ctx context.Context, in *alpha.GetCounterReq defer l.gsMutex.RUnlock() if counter, ok := l.gs.Status.Counters[in.Name]; ok { - return &alpha.Counter{Name: in.Name, Count: counter.Count, Capacity: counter.Capacity}, nil + return &beta.Counter{Name: in.Name, Count: counter.Count, Capacity: counter.Capacity}, nil } return nil, errors.Errorf("not found. %s Counter not found", in.Name) } @@ -636,9 +636,9 @@ func (l *LocalSDKServer) GetCounter(ctx context.Context, in *alpha.GetCounterReq // does not batch requests, and directly updates the localsdk gameserver. // Returns error if the Counter does not exist (name cannot be updated). // Returns error if the Count is out of range [0,Capacity]. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (l *LocalSDKServer) UpdateCounter(ctx context.Context, in *alpha.UpdateCounterRequest) (*alpha.Counter, error) { +func (l *LocalSDKServer) UpdateCounter(ctx context.Context, in *beta.UpdateCounterRequest) (*beta.Counter, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -658,7 +658,7 @@ func (l *LocalSDKServer) UpdateCounter(ctx context.Context, in *alpha.UpdateCoun return nil, errors.Errorf("not found. %s Counter not found", name) } - tmpCounter := alpha.Counter{Name: name, Count: counter.Count, Capacity: counter.Capacity} + tmpCounter := beta.Counter{Name: name, Count: counter.Count, Capacity: counter.Capacity} // Set Capacity if in.CounterUpdateRequest.Capacity != nil { l.recordRequest("setcapacitycounter") @@ -695,9 +695,9 @@ func (l *LocalSDKServer) UpdateCounter(ctx context.Context, in *alpha.UpdateCoun } // GetList returns a List. Returns not found if the List does not exist. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (l *LocalSDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) (*alpha.List, error) { +func (l *LocalSDKServer) GetList(ctx context.Context, in *beta.GetListRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -708,7 +708,7 @@ func (l *LocalSDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) defer l.gsMutex.RUnlock() if list, ok := l.gs.Status.Lists[in.Name]; ok { - return &alpha.List{Name: in.Name, Capacity: list.Capacity, Values: list.Values}, nil + return &beta.List{Name: in.Name, Capacity: list.Capacity, Values: list.Values}, nil } return nil, errors.Errorf("not found. %s List not found", in.Name) } @@ -719,9 +719,9 @@ func (l *LocalSDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) // Returns invalid argument if the field mask path(s) are not field(s) of the List. // If a field mask path(s) is specified, but the value is not set in the request List object, // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (l *LocalSDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListRequest) (*alpha.List, error) { +func (l *LocalSDKServer) UpdateList(ctx context.Context, in *beta.UpdateListRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -747,8 +747,8 @@ func (l *LocalSDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListReq name := in.List.Name if list, ok := l.gs.Status.Lists[name]; ok { - // Create *alpha.List from *sdk.GameServer_Status_ListStatus for merging. - tmpList := &alpha.List{Name: name, Capacity: list.Capacity, Values: list.Values} + // Create *beta.List from *sdk.GameServer_Status_ListStatus for merging. + tmpList := &beta.List{Name: name, Capacity: list.Capacity, Values: list.Values} // Removes any fields from the request object that are not included in the FieldMask Paths. fmutils.Filter(in.List, in.UpdateMask.Paths) // Removes any fields from the existing gameserver object that are included in the FieldMask Paths. @@ -762,7 +762,7 @@ func (l *LocalSDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListReq // Write newly updated List to gameserverstatus. l.gs.Status.Lists[name].Capacity = tmpList.Capacity l.gs.Status.Lists[name].Values = tmpList.Values - return &alpha.List{Name: name, Capacity: l.gs.Status.Lists[name].Capacity, Values: l.gs.Status.Lists[name].Values}, nil + return &beta.List{Name: name, Capacity: l.gs.Status.Lists[name].Capacity, Values: l.gs.Status.Lists[name].Values}, nil } return nil, errors.Errorf("not found. %s List not found", name) } @@ -771,9 +771,9 @@ func (l *LocalSDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListReq // Returns not found if the List does not exist. // Returns already exists if the value is already in the List. // Returns out of range if the List is already at Capacity. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (l *LocalSDKServer) AddListValue(ctx context.Context, in *alpha.AddListValueRequest) (*alpha.List, error) { +func (l *LocalSDKServer) AddListValue(ctx context.Context, in *beta.AddListValueRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -796,7 +796,7 @@ func (l *LocalSDKServer) AddListValue(ctx context.Context, in *alpha.AddListValu } // Add new value to gameserverstatus. l.gs.Status.Lists[in.Name].Values = append(l.gs.Status.Lists[in.Name].Values, in.Value) - return &alpha.List{Name: in.Name, Capacity: l.gs.Status.Lists[in.Name].Capacity, Values: l.gs.Status.Lists[in.Name].Values}, nil + return &beta.List{Name: in.Name, Capacity: l.gs.Status.Lists[in.Name].Capacity, Values: l.gs.Status.Lists[in.Name].Values}, nil } return nil, errors.Errorf("not found. %s List not found", in.Name) } @@ -804,9 +804,9 @@ func (l *LocalSDKServer) AddListValue(ctx context.Context, in *alpha.AddListValu // RemoveListValue removes a value from a List and returns updated List. // Returns not found if the List does not exist. // Returns not found if the value is not in the List. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (l *LocalSDKServer) RemoveListValue(ctx context.Context, in *alpha.RemoveListValueRequest) (*alpha.List, error) { +func (l *LocalSDKServer) RemoveListValue(ctx context.Context, in *beta.RemoveListValueRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -822,7 +822,7 @@ func (l *LocalSDKServer) RemoveListValue(ctx context.Context, in *alpha.RemoveLi if in.Value == val { // Remove value (maintains list ordering and modifies underlying gameserverstatus List.Values array). list.Values = append(list.Values[:i], list.Values[i+1:]...) - return &alpha.List{Name: in.Name, Capacity: l.gs.Status.Lists[in.Name].Capacity, Values: l.gs.Status.Lists[in.Name].Values}, nil + return &beta.List{Name: in.Name, Capacity: l.gs.Status.Lists[in.Name].Capacity, Values: l.gs.Status.Lists[in.Name].Values}, nil } } return nil, errors.Errorf("not found. Value: %s not found in List: %s", in.Value, in.Name) diff --git a/pkg/sdkserver/localsdk_test.go b/pkg/sdkserver/localsdk_test.go index 7705e4ab86..44d310b2ce 100644 --- a/pkg/sdkserver/localsdk_test.go +++ b/pkg/sdkserver/localsdk_test.go @@ -24,10 +24,6 @@ import ( "testing" "time" - agonesv1 "agones.dev/agones/pkg/apis/agones/v1" - "agones.dev/agones/pkg/sdk" - "agones.dev/agones/pkg/sdk/alpha" - "agones.dev/agones/pkg/util/runtime" "github.com/google/go-cmp/cmp" "github.com/pkg/errors" "github.com/stretchr/testify/assert" @@ -36,6 +32,12 @@ import ( "google.golang.org/protobuf/types/known/wrapperspb" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" + + agonesv1 "agones.dev/agones/pkg/apis/agones/v1" + "agones.dev/agones/pkg/sdk" + "agones.dev/agones/pkg/sdk/alpha" + "agones.dev/agones/pkg/sdk/beta" + "agones.dev/agones/pkg/util/runtime" ) func TestLocal(t *testing.T) { @@ -654,12 +656,12 @@ func TestLocalSDKServerGetCounter(t *testing.T) { testScenarios := map[string]struct { name string - want *alpha.Counter + want *beta.Counter wantErr error }{ "Counter exists": { name: "sessions", - want: &alpha.Counter{Name: "sessions", Count: int64(1), Capacity: int64(100)}, + want: &beta.Counter{Name: "sessions", Count: int64(1), Capacity: int64(100)}, }, "Counter does not exist": { name: "noName", @@ -669,7 +671,7 @@ func TestLocalSDKServerGetCounter(t *testing.T) { for testName, testScenario := range testScenarios { t.Run(testName, func(t *testing.T) { - got, err := l.GetCounter(context.Background(), &alpha.GetCounterRequest{Name: testScenario.name}) + got, err := l.GetCounter(context.Background(), &beta.GetCounterRequest{Name: testScenario.name}) // Check tests expecting non-errors if testScenario.want != nil { assert.NoError(t, err) @@ -729,89 +731,89 @@ func TestLocalSDKServerUpdateCounter(t *testing.T) { assert.NoError(t, err) testScenarios := map[string]struct { - updateRequest *alpha.UpdateCounterRequest - want *alpha.Counter + updateRequest *beta.UpdateCounterRequest + want *beta.Counter wantErr error }{ "Set Counter Capacity": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "lobbies", Capacity: wrapperspb.Int64(10), }}, - want: &alpha.Counter{ + want: &beta.Counter{ Name: "lobbies", Count: 0, Capacity: 10, }, }, "Set Counter Count": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "npcs", Count: wrapperspb.Int64(10), }}, - want: &alpha.Counter{ + want: &beta.Counter{ Name: "npcs", Count: 10, Capacity: 10, }, }, "Decrement Counter Count": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "games", CountDiff: -5, }}, - want: &alpha.Counter{ + want: &beta.Counter{ Name: "games", Count: 0, Capacity: 10, }, }, "Cannot Decrement Counter": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "sessions", CountDiff: -2, }}, wantErr: errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", -1, 100), }, "Cannot Increment Counter": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "players", CountDiff: 1, }}, wantErr: errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", 101, 100), }, "Counter does not exist": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "dragons", CountDiff: 1, }}, wantErr: errors.Errorf("not found. %s Counter not found", "dragons"), }, "request Counter is nil": { - updateRequest: &alpha.UpdateCounterRequest{ + updateRequest: &beta.UpdateCounterRequest{ CounterUpdateRequest: nil, }, wantErr: errors.Errorf("invalid argument. CounterUpdateRequest cannot be nil"), }, "capacity is less than zero": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "lobbies", Capacity: wrapperspb.Int64(-1), }}, wantErr: errors.Errorf("out of range. Capacity must be greater than or equal to 0. Found Capacity: %d", -1), }, "count is less than zero": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "players", Count: wrapperspb.Int64(-1), }}, wantErr: errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", -1, 100), }, "count is greater than capacity": { - updateRequest: &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + updateRequest: &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "players", Count: wrapperspb.Int64(101), }}, @@ -878,12 +880,12 @@ func TestLocalSDKServerGetList(t *testing.T) { testScenarios := map[string]struct { name string - want *alpha.List + want *beta.List wantErr error }{ "List exists": { name: "games", - want: &alpha.List{Name: "games", Capacity: int64(100), Values: []string{"game1", "game2"}}, + want: &beta.List{Name: "games", Capacity: int64(100), Values: []string{"game1", "game2"}}, }, "List does not exist": { name: "noName", @@ -893,7 +895,7 @@ func TestLocalSDKServerGetList(t *testing.T) { for testName, testScenario := range testScenarios { t.Run(testName, func(t *testing.T) { - got, err := l.GetList(context.Background(), &alpha.GetListRequest{Name: testScenario.name}) + got, err := l.GetList(context.Background(), &beta.GetListRequest{Name: testScenario.name}) // Check tests expecting non-errors if testScenario.want != nil { assert.NoError(t, err) @@ -953,69 +955,69 @@ func TestLocalSDKServerUpdateList(t *testing.T) { assert.NoError(t, err) testScenarios := map[string]struct { - updateRequest *alpha.UpdateListRequest - want *alpha.List + updateRequest *beta.UpdateListRequest + want *beta.List wantErr error }{ "only updates fields in the FieldMask": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "games", Capacity: int64(999), Values: []string{"game3"}, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"capacity"}}, }, - want: &alpha.List{ + want: &beta.List{ Name: "games", Capacity: int64(999), Values: []string{"game1", "game2"}, }, }, "updates both fields in the FieldMask": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "unicorns", Capacity: int64(42), Values: []string{"unicorn0"}, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"values", "capacity"}}, }, - want: &alpha.List{ + want: &beta.List{ Name: "unicorns", Capacity: int64(42), Values: []string{"unicorn0"}, }, }, "default value for Capacity applied": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "clients", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"capacity"}}, }, - want: &alpha.List{ + want: &beta.List{ Name: "clients", Capacity: int64(0), Values: []string{}, }, }, "default value for Values applied": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "assets", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"values"}}, }, - want: &alpha.List{ + want: &beta.List{ Name: "assets", Capacity: int64(1), Values: []string{}, }, }, "List does not exist": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "dragons", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"capacity"}}, @@ -1023,22 +1025,22 @@ func TestLocalSDKServerUpdateList(t *testing.T) { wantErr: errors.Errorf("not found. %s List not found", "dragons"), }, "request List is nil": { - updateRequest: &alpha.UpdateListRequest{ + updateRequest: &beta.UpdateListRequest{ List: nil, UpdateMask: &fieldmaskpb.FieldMask{}, }, wantErr: errors.Errorf("invalid argument. List: %v and UpdateMask %v cannot be nil", nil, &fieldmaskpb.FieldMask{}), }, "request UpdateMask is nil": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{}, + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{}, UpdateMask: nil, }, - wantErr: errors.Errorf("invalid argument. List: %v and UpdateMask %v cannot be nil", &alpha.List{}, nil), + wantErr: errors.Errorf("invalid argument. List: %v and UpdateMask %v cannot be nil", &beta.List{}, nil), }, "updateMask contains invalid path": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "assets", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"foo"}}, @@ -1046,8 +1048,8 @@ func TestLocalSDKServerUpdateList(t *testing.T) { wantErr: errors.Errorf("invalid argument. Field Mask Path(s): [foo] are invalid for List. Use valid field name(s): "), }, "updateMask is empty": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "unicorns", }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{""}}, @@ -1055,8 +1057,8 @@ func TestLocalSDKServerUpdateList(t *testing.T) { wantErr: errors.Errorf("invalid argument. Field Mask Path(s): [] are invalid for List. Use valid field name(s): "), }, "capacity is less than zero": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "clients", Capacity: -1, }, @@ -1065,8 +1067,8 @@ func TestLocalSDKServerUpdateList(t *testing.T) { wantErr: errors.Errorf("out of range. Capacity must be within range [0,1000]. Found Capacity: %d", -1), }, "capacity greater than max capacity (1000)": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "clients", Capacity: 1001, }, @@ -1075,14 +1077,14 @@ func TestLocalSDKServerUpdateList(t *testing.T) { wantErr: errors.Errorf("out of range. Capacity must be within range [0,1000]. Found Capacity: %d", 1001), }, "capacity is less than List length": { - updateRequest: &alpha.UpdateListRequest{ - List: &alpha.List{ + updateRequest: &beta.UpdateListRequest{ + List: &beta.List{ Name: "models", Capacity: 1, }, UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"capacity"}}, }, - want: &alpha.List{ + want: &beta.List{ Name: "models", Capacity: int64(1), Values: []string{"model1"}, @@ -1149,32 +1151,32 @@ func TestLocalSDKServerAddListValue(t *testing.T) { assert.NoError(t, err) testScenarios := map[string]struct { - addRequest *alpha.AddListValueRequest - want *alpha.List + addRequest *beta.AddListValueRequest + want *beta.List wantErr error }{ "add List value": { - addRequest: &alpha.AddListValueRequest{ + addRequest: &beta.AddListValueRequest{ Name: "lemmings", Value: "lemming3", }, - want: &alpha.List{Name: "lemmings", Capacity: int64(100), Values: []string{"lemming1", "lemming2", "lemming3"}}, + want: &beta.List{Name: "lemmings", Capacity: int64(100), Values: []string{"lemming1", "lemming2", "lemming3"}}, }, "List does not exist": { - addRequest: &alpha.AddListValueRequest{ + addRequest: &beta.AddListValueRequest{ Name: "dragons", }, wantErr: errors.Errorf("not found. %s List not found", "dragons"), }, "add more values than capacity": { - addRequest: &alpha.AddListValueRequest{ + addRequest: &beta.AddListValueRequest{ Name: "hacks", Value: "hack3", }, wantErr: errors.Errorf("out of range. No available capacity. Current Capacity: %d, List Size: %d", int64(2), int64(2)), }, "add existing value": { - addRequest: &alpha.AddListValueRequest{ + addRequest: &beta.AddListValueRequest{ Name: "lemmings", Value: "lemming1", }, @@ -1241,25 +1243,25 @@ func TestLocalSDKServerRemoveListValue(t *testing.T) { assert.NoError(t, err) testScenarios := map[string]struct { - removeRequest *alpha.RemoveListValueRequest - want *alpha.List + removeRequest *beta.RemoveListValueRequest + want *beta.List wantErr error }{ "remove List value": { - removeRequest: &alpha.RemoveListValueRequest{ + removeRequest: &beta.RemoveListValueRequest{ Name: "players", Value: "player1", }, - want: &alpha.List{Name: "players", Capacity: int64(100), Values: []string{"player2"}}, + want: &beta.List{Name: "players", Capacity: int64(100), Values: []string{"player2"}}, }, "List does not exist": { - removeRequest: &alpha.RemoveListValueRequest{ + removeRequest: &beta.RemoveListValueRequest{ Name: "dragons", }, wantErr: errors.Errorf("not found. %s List not found", "dragons"), }, "value does not exist": { - removeRequest: &alpha.RemoveListValueRequest{ + removeRequest: &beta.RemoveListValueRequest{ Name: "items", Value: "item3", }, diff --git a/pkg/sdkserver/sdkserver.go b/pkg/sdkserver/sdkserver.go index 15a142349c..abffd27bee 100644 --- a/pkg/sdkserver/sdkserver.go +++ b/pkg/sdkserver/sdkserver.go @@ -793,9 +793,9 @@ func (s *SDKServer) GetPlayerCapacity(ctx context.Context, _ *alpha.Empty) (*alp } // GetCounter returns a Counter. Returns error if the counter does not exist. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (s *SDKServer) GetCounter(ctx context.Context, in *alpha.GetCounterRequest) (*alpha.Counter, error) { +func (s *SDKServer) GetCounter(ctx context.Context, in *beta.GetCounterRequest) (*beta.Counter, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -815,7 +815,7 @@ func (s *SDKServer) GetCounter(ctx context.Context, in *alpha.GetCounterRequest) return nil, errors.Errorf("counter not found: %s", in.Name) } s.logger.WithField("Get Counter", counter).Debugf("Got Counter %s", in.Name) - protoCounter := alpha.Counter{Name: in.Name, Count: counter.Count, Capacity: counter.Capacity} + protoCounter := beta.Counter{Name: in.Name, Count: counter.Count, Capacity: counter.Capacity} // If there are batched changes that have not yet been applied, apply them to the Counter. // This does NOT validate batched the changes. if counterUpdate, ok := s.gsCounterUpdates[in.Name]; ok { @@ -844,9 +844,9 @@ func (s *SDKServer) GetCounter(ctx context.Context, in *alpha.GetCounterRequest) // UpdateCounterRequest must be one and only one of Capacity, Count, or CountDiff. // Returns error if the Counter does not exist (name cannot be updated). // Returns error if the Count is out of range [0,Capacity]. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (s *SDKServer) UpdateCounter(ctx context.Context, in *alpha.UpdateCounterRequest) (*alpha.Counter, error) { +func (s *SDKServer) UpdateCounter(ctx context.Context, in *beta.UpdateCounterRequest) (*beta.Counter, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -928,7 +928,7 @@ func (s *SDKServer) UpdateCounter(ctx context.Context, in *alpha.UpdateCounterRe // Queue up the Update for later batch processing by updateCounters. s.workerqueue.Enqueue(cache.ExplicitKey(updateCounters)) - return &alpha.Counter{}, nil + return &beta.Counter{}, nil } // updateCounter updates the Counters in the GameServer's Status with the batched update requests. @@ -994,9 +994,9 @@ func (s *SDKServer) updateCounter(ctx context.Context) error { } // GetList returns a List. Returns not found if the List does not exist. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (s *SDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) (*alpha.List, error) { +func (s *SDKServer) GetList(ctx context.Context, in *beta.GetListRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -1019,7 +1019,7 @@ func (s *SDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) (*alp } s.logger.WithField("Get List", list).Debugf("Got List %s", in.Name) - protoList := alpha.List{Name: in.Name, Values: list.Values, Capacity: list.Capacity} + protoList := beta.List{Name: in.Name, Values: list.Values, Capacity: list.Capacity} // If there are batched changes that have not yet been applied, apply them to the List. // This does NOT validate batched the changes, and does NOT modify the List. if listUpdate, ok := s.gsListUpdates[in.Name]; ok { @@ -1046,9 +1046,9 @@ func (s *SDKServer) GetList(ctx context.Context, in *alpha.GetListRequest) (*alp // This function currently only updates the Capacity of a List. // Returns error if the List does not exist (name cannot be updated). // Returns error if the List update capacity is out of range [0,1000]. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (s *SDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListRequest) (*alpha.List, error) { +func (s *SDKServer) UpdateList(ctx context.Context, in *beta.UpdateListRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -1077,7 +1077,7 @@ func (s *SDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListRequest) s.gsListUpdates[name] = batchList // Queue up the Update for later batch processing by updateLists. s.workerqueue.Enqueue(cache.ExplicitKey(updateLists)) - return &alpha.List{}, nil + return &beta.List{}, nil } return nil, errors.Errorf("not found. %s List not found", name) } @@ -1086,9 +1086,9 @@ func (s *SDKServer) UpdateList(ctx context.Context, in *alpha.UpdateListRequest) // Returns not found if the List does not exist. // Returns already exists if the value is already in the List. // Returns out of range if the List is already at Capacity. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (s *SDKServer) AddListValue(ctx context.Context, in *alpha.AddListValueRequest) (*alpha.List, error) { +func (s *SDKServer) AddListValue(ctx context.Context, in *beta.AddListValueRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -1097,7 +1097,7 @@ func (s *SDKServer) AddListValue(ctx context.Context, in *alpha.AddListValueRequ } s.logger.WithField("name", in.Name).Debug("Add List Value") - list, err := s.GetList(ctx, &alpha.GetListRequest{Name: in.Name}) + list, err := s.GetList(ctx, &beta.GetListRequest{Name: in.Name}) if err != nil { return nil, err } @@ -1121,15 +1121,15 @@ func (s *SDKServer) AddListValue(ctx context.Context, in *alpha.AddListValueRequ s.gsListUpdates[in.Name] = batchList // Queue up the Update for later batch processing by updateLists. s.workerqueue.Enqueue(cache.ExplicitKey(updateLists)) - return &alpha.List{}, nil + return &beta.List{}, nil } // RemoveListValue collapses all remove a value from a List requests into a single UpdateList request. // Returns not found if the List does not exist. // Returns not found if the value is not in the List. -// [Stage:Alpha] +// [Stage:Beta] // [FeatureFlag:CountsAndLists] -func (s *SDKServer) RemoveListValue(ctx context.Context, in *alpha.RemoveListValueRequest) (*alpha.List, error) { +func (s *SDKServer) RemoveListValue(ctx context.Context, in *beta.RemoveListValueRequest) (*beta.List, error) { if !runtime.FeatureEnabled(runtime.FeatureCountsAndLists) { return nil, errors.Errorf("%s not enabled", runtime.FeatureCountsAndLists) } @@ -1138,7 +1138,7 @@ func (s *SDKServer) RemoveListValue(ctx context.Context, in *alpha.RemoveListVal } s.logger.WithField("name", in.Name).Debug("Remove List Value") - list, err := s.GetList(ctx, &alpha.GetListRequest{Name: in.Name}) + list, err := s.GetList(ctx, &beta.GetListRequest{Name: in.Name}) if err != nil { return nil, err } @@ -1160,7 +1160,7 @@ func (s *SDKServer) RemoveListValue(ctx context.Context, in *alpha.RemoveListVal s.gsListUpdates[in.Name] = batchList // Queue up the Update for later batch processing by updateLists. s.workerqueue.Enqueue(cache.ExplicitKey(updateLists)) - return &alpha.List{}, nil + return &beta.List{}, nil } return nil, errors.Errorf("not found. Value: %s not found in List: %s", in.Value, in.Name) } diff --git a/pkg/sdkserver/sdkserver_test.go b/pkg/sdkserver/sdkserver_test.go index d8e1d2adab..de57c12a86 100644 --- a/pkg/sdkserver/sdkserver_test.go +++ b/pkg/sdkserver/sdkserver_test.go @@ -26,6 +26,7 @@ import ( "agones.dev/agones/pkg/gameserverallocations" "agones.dev/agones/pkg/sdk" "agones.dev/agones/pkg/sdk/alpha" + "agones.dev/agones/pkg/sdk/beta" agtesting "agones.dev/agones/pkg/testing" agruntime "agones.dev/agones/pkg/util/runtime" "github.com/google/go-cmp/cmp" @@ -1111,15 +1112,15 @@ func TestSDKServerUpdateCounter(t *testing.T) { fixtures := map[string]struct { counterName string - requests []*alpha.UpdateCounterRequest + requests []*beta.UpdateCounterRequest want agonesv1.CounterStatus updateErrs []bool updated bool }{ "increment": { counterName: "widgets", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "widgets", CountDiff: 9, }}}, @@ -1129,8 +1130,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "increment illegal": { counterName: "widgets", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "foo", CountDiff: 100, }}}, @@ -1140,8 +1141,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "decrement": { counterName: "bar", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "bar", CountDiff: -1, }}}, @@ -1151,8 +1152,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "decrement illegal": { counterName: "baz", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "baz", CountDiff: -11, }}}, @@ -1162,8 +1163,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "set capacity": { counterName: "bazel", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "bazel", Capacity: wrapperspb.Int64(0), }}}, @@ -1173,8 +1174,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "set capacity illegal": { counterName: "fish", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "fish", Capacity: wrapperspb.Int64(-1), }}}, @@ -1184,8 +1185,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "set count": { counterName: "onefish", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "onefish", Count: wrapperspb.Int64(42), }}}, @@ -1195,8 +1196,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "set count illegal": { counterName: "twofish", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "twofish", Count: wrapperspb.Int64(101), }}}, @@ -1206,12 +1207,12 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "increment past set capacity illegal": { counterName: "redfish", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "redfish", Capacity: wrapperspb.Int64(0), }}, - {CounterUpdateRequest: &alpha.CounterUpdateRequest{ + {CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "redfish", CountDiff: 1, }}}, @@ -1221,12 +1222,12 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "decrement past set capacity illegal": { counterName: "bluefish", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "bluefish", Capacity: wrapperspb.Int64(0), }}, - {CounterUpdateRequest: &alpha.CounterUpdateRequest{ + {CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "bluefish", CountDiff: -1, }}}, @@ -1236,8 +1237,8 @@ func TestSDKServerUpdateCounter(t *testing.T) { }, "setcapacity, setcount, and diffcount": { counterName: "fivefish", - requests: []*alpha.UpdateCounterRequest{{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ + requests: []*beta.UpdateCounterRequest{{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ Name: "fivefish", Capacity: wrapperspb.Int64(25), Count: wrapperspb.Int64(0), @@ -1298,7 +1299,7 @@ func TestSDKServerUpdateCounter(t *testing.T) { // check initial value comes through require.Eventually(t, func() bool { - counter, err := sc.GetCounter(context.Background(), &alpha.GetCounterRequest{Name: testCase.counterName}) + counter, err := sc.GetCounter(context.Background(), &beta.GetCounterRequest{Name: testCase.counterName}) return counter.Count == 10 && counter.Capacity == 100 && err == nil }, 10*time.Second, time.Second) @@ -1312,7 +1313,7 @@ func TestSDKServerUpdateCounter(t *testing.T) { } } - got, err := sc.GetCounter(context.Background(), &alpha.GetCounterRequest{Name: testCase.counterName}) + got, err := sc.GetCounter(context.Background(), &beta.GetCounterRequest{Name: testCase.counterName}) assert.NoError(t, err) assert.Equal(t, testCase.want.Count, got.Count) assert.Equal(t, testCase.want.Capacity, got.Capacity) @@ -1352,7 +1353,7 @@ func TestSDKServerAddListValue(t *testing.T) { fixtures := map[string]struct { listName string - requests []*alpha.AddListValueRequest + requests []*beta.AddListValueRequest want agonesv1.ListStatus updateErrs []bool updated bool @@ -1360,7 +1361,7 @@ func TestSDKServerAddListValue(t *testing.T) { }{ "Add value": { listName: "foo", - requests: []*alpha.AddListValueRequest{{Name: "foo", Value: "five"}}, + requests: []*beta.AddListValueRequest{{Name: "foo", Value: "five"}}, want: agonesv1.ListStatus{Values: []string{"one", "two", "three", "four", "five"}, Capacity: int64(10)}, updateErrs: []bool{false}, updated: true, @@ -1368,7 +1369,7 @@ func TestSDKServerAddListValue(t *testing.T) { }, "Add multiple values including duplicates": { listName: "bar", - requests: []*alpha.AddListValueRequest{ + requests: []*beta.AddListValueRequest{ {Name: "bar", Value: "five"}, {Name: "bar", Value: "one"}, {Name: "bar", Value: "five"}, @@ -1381,7 +1382,7 @@ func TestSDKServerAddListValue(t *testing.T) { }, "Add multiple values past capacity": { listName: "baz", - requests: []*alpha.AddListValueRequest{ + requests: []*beta.AddListValueRequest{ {Name: "baz", Value: "five"}, {Name: "baz", Value: "six"}, {Name: "baz", Value: "seven"}, @@ -1442,7 +1443,7 @@ func TestSDKServerAddListValue(t *testing.T) { // check initial value comes through require.Eventually(t, func() bool { - list, err := sc.GetList(context.Background(), &alpha.GetListRequest{Name: testCase.listName}) + list, err := sc.GetList(context.Background(), &beta.GetListRequest{Name: testCase.listName}) return cmp.Equal(list.Values, []string{"one", "two", "three", "four"}) && list.Capacity == 10 && err == nil }, 10*time.Second, time.Second) @@ -1456,7 +1457,7 @@ func TestSDKServerAddListValue(t *testing.T) { } } - got, err := sc.GetList(context.Background(), &alpha.GetListRequest{Name: testCase.listName}) + got, err := sc.GetList(context.Background(), &beta.GetListRequest{Name: testCase.listName}) assert.NoError(t, err) assert.Equal(t, testCase.want.Values, got.Values) assert.Equal(t, testCase.want.Capacity, got.Capacity) @@ -1507,7 +1508,7 @@ func TestSDKServerRemoveListValue(t *testing.T) { fixtures := map[string]struct { listName string - requests []*alpha.RemoveListValueRequest + requests []*beta.RemoveListValueRequest want agonesv1.ListStatus updateErrs []bool updated bool @@ -1515,7 +1516,7 @@ func TestSDKServerRemoveListValue(t *testing.T) { }{ "Remove value": { listName: "foo", - requests: []*alpha.RemoveListValueRequest{{Name: "foo", Value: "two"}}, + requests: []*beta.RemoveListValueRequest{{Name: "foo", Value: "two"}}, want: agonesv1.ListStatus{Values: []string{"one", "three", "four"}, Capacity: int64(100)}, updateErrs: []bool{false}, updated: true, @@ -1523,7 +1524,7 @@ func TestSDKServerRemoveListValue(t *testing.T) { }, "Remove multiple values including duplicates": { listName: "bar", - requests: []*alpha.RemoveListValueRequest{ + requests: []*beta.RemoveListValueRequest{ {Name: "bar", Value: "two"}, {Name: "bar", Value: "three"}, {Name: "bar", Value: "two"}, @@ -1535,7 +1536,7 @@ func TestSDKServerRemoveListValue(t *testing.T) { }, "Remove all values": { listName: "baz", - requests: []*alpha.RemoveListValueRequest{ + requests: []*beta.RemoveListValueRequest{ {Name: "baz", Value: "three"}, {Name: "baz", Value: "two"}, {Name: "baz", Value: "four"}, @@ -1590,7 +1591,7 @@ func TestSDKServerRemoveListValue(t *testing.T) { // check initial value comes through require.Eventually(t, func() bool { - list, err := sc.GetList(context.Background(), &alpha.GetListRequest{Name: testCase.listName}) + list, err := sc.GetList(context.Background(), &beta.GetListRequest{Name: testCase.listName}) return cmp.Equal(list.Values, []string{"one", "two", "three", "four"}) && list.Capacity == 100 && err == nil }, 10*time.Second, time.Second) @@ -1604,7 +1605,7 @@ func TestSDKServerRemoveListValue(t *testing.T) { } } - got, err := sc.GetList(context.Background(), &alpha.GetListRequest{Name: testCase.listName}) + got, err := sc.GetList(context.Background(), &beta.GetListRequest{Name: testCase.listName}) assert.NoError(t, err) assert.Equal(t, testCase.want.Values, got.Values) assert.Equal(t, testCase.want.Capacity, got.Capacity) @@ -1655,7 +1656,7 @@ func TestSDKServerUpdateList(t *testing.T) { fixtures := map[string]struct { listName string - request *alpha.UpdateListRequest + request *beta.UpdateListRequest want agonesv1.ListStatus updateErr bool updated bool @@ -1663,8 +1664,8 @@ func TestSDKServerUpdateList(t *testing.T) { }{ "set capacity to max": { listName: "foo", - request: &alpha.UpdateListRequest{ - List: &alpha.List{ + request: &beta.UpdateListRequest{ + List: &beta.List{ Name: "foo", Capacity: int64(1000), }, @@ -1677,8 +1678,8 @@ func TestSDKServerUpdateList(t *testing.T) { }, "set capacity to min values are truncated": { listName: "bar", - request: &alpha.UpdateListRequest{ - List: &alpha.List{ + request: &beta.UpdateListRequest{ + List: &beta.List{ Name: "bar", Capacity: int64(0), }, @@ -1691,8 +1692,8 @@ func TestSDKServerUpdateList(t *testing.T) { }, "set capacity past max": { listName: "baz", - request: &alpha.UpdateListRequest{ - List: &alpha.List{ + request: &beta.UpdateListRequest{ + List: &beta.List{ Name: "baz", Capacity: int64(1001), }, @@ -1755,7 +1756,7 @@ func TestSDKServerUpdateList(t *testing.T) { // check initial value comes through require.Eventually(t, func() bool { - list, err := sc.GetList(context.Background(), &alpha.GetListRequest{Name: testCase.listName}) + list, err := sc.GetList(context.Background(), &beta.GetListRequest{Name: testCase.listName}) return cmp.Equal(list.Values, []string{"one", "two", "three", "four"}) && list.Capacity == 100 && err == nil }, 10*time.Second, time.Second) @@ -1767,7 +1768,7 @@ func TestSDKServerUpdateList(t *testing.T) { assert.NoError(t, err) } - got, err := sc.GetList(context.Background(), &alpha.GetListRequest{Name: testCase.listName}) + got, err := sc.GetList(context.Background(), &beta.GetListRequest{Name: testCase.listName}) assert.NoError(t, err) assert.Equal(t, testCase.want.Values, got.Values) assert.Equal(t, testCase.want.Capacity, got.Capacity) diff --git a/pkg/util/webhooks/webhooks_test.go b/pkg/util/webhooks/webhooks_test.go index 199cb82f69..8980654572 100644 --- a/pkg/util/webhooks/webhooks_test.go +++ b/pkg/util/webhooks/webhooks_test.go @@ -164,7 +164,7 @@ func TestWebHookFleetValidationHandler(t *testing.T) { "template": { "spec": { "containers": [{ - "image": "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31", + "image": "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32", "name": false }] } diff --git a/proto/sdk/alpha/alpha.proto b/proto/sdk/alpha/alpha.proto index 8e92cf7006..1db8bc74d9 100644 --- a/proto/sdk/alpha/alpha.proto +++ b/proto/sdk/alpha/alpha.proto @@ -18,12 +18,6 @@ package agones.dev.sdk.alpha; option go_package = "./alpha"; import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { @@ -128,65 +122,6 @@ service SDK { get: "/alpha/player/connected" }; } - - // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. - rpc GetCounter(GetCounterRequest) returns (Counter) { - option (google.api.http) = { - get: "/v1alpha1/counters/{name}" - }; - option (google.api.method_signature) = "name"; - } - - // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). - // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. - rpc UpdateCounter(UpdateCounterRequest) returns (Counter) { - option (google.api.http) = { - patch: "/v1alpha1/counters/{counterUpdateRequest.name}" - body: "counterUpdateRequest" - }; - option (google.api.method_signature) = "counterUpdateRequest"; - } - - // Gets a List. Returns NOT_FOUND if the List does not exist. - rpc GetList(GetListRequest) returns (List) { - option (google.api.http) = { - get: "/v1alpha1/lists/{name}" - }; - option (google.api.method_signature) = "name"; - } - - // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). - // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** - // Use AddListValue() or RemoveListValue() for modifying the List.Values field. - // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. - // If a field mask path(s) is specified, but the value is not set in the request List object, - // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). - rpc UpdateList(UpdateListRequest) returns (List) { - option (google.api.http) = { - patch: "/v1alpha1/lists/{list.name}" - body: "list" - }; - option (google.api.method_signature) = "list,update_mask"; - } - - // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns ALREADY_EXISTS if the value is already in the List. - // Returns OUT_OF_RANGE if the List is already at Capacity. - rpc AddListValue(AddListValueRequest) returns (List) { - option (google.api.http) = { - post: "/v1alpha1/lists/{name}:addValue" - body: "*" - }; - } - - // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns NOT_FOUND if the value is not in the List. - rpc RemoveListValue(RemoveListValueRequest) returns (List) { - option (google.api.http) = { - post: "/v1alpha1/lists/{name}:removeValue" - body: "*" - }; - } } // I am Empty @@ -212,111 +147,3 @@ message PlayerID { message PlayerIDList { repeated string list = 1; } - -// A representation of a Counter. -message Counter { - option (google.api.resource) = { - type: "agones.dev/Counter" - pattern: "counters/{counter}" - }; - // The name of the Counter - string name = 1; - // The current count of the Counter - int64 count = 2; - // The maximum capacity of the Counter - int64 capacity = 3; -} - -// A representation of a Counter Update Request. -message CounterUpdateRequest { - option (google.api.resource) = { - type: "agones.dev/CounterUpdateRequest" - pattern: "counterUpdateRequests/{counterUpdateRequest}" - }; - // The name of the Counter to update - string name = 1; - // The value to set the Counter Count - google.protobuf.Int64Value count = 2; - // The value to set the Counter Capacity - google.protobuf.Int64Value capacity = 3; - // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement - // (negative), 0 if a CountSet or CapacitySet request - int64 countDiff = 4; -} - -message GetCounterRequest { - // The name of the Counter to get - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/Counter" - }]; -} - -message UpdateCounterRequest { - // The requested update to make to the Counter - CounterUpdateRequest counterUpdateRequest = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/CounterUpdateRequest" - }]; -} - -// A representation of a List. -message List { - option (google.api.resource) = { - type: "agones.dev/List" - pattern: "lists/{list}" - }; - // The name of the List - string name = 1; - // The maximum capacity of the List - int64 capacity = 2; - // The array of items in the List ["v1", "v2", …] - repeated string values = 3; -} - -message GetListRequest { - // The name of the List to get - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; -} - -message UpdateListRequest { - // The List to update - List list = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - // Required. Mask (list) of fields to update. - // Fields are specified relative to the List - // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message AddListValueRequest { - // The name of the List to add a value to. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message RemoveListValueRequest { - // The name of the List to remove a value from. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/proto/sdk/beta/beta.proto b/proto/sdk/beta/beta.proto index d0ef73fc57..0542cb64a2 100644 --- a/proto/sdk/beta/beta.proto +++ b/proto/sdk/beta/beta.proto @@ -18,6 +18,12 @@ package agones.dev.sdk.beta; option go_package = "./beta"; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { @@ -31,4 +37,175 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { }; // SDK service to be used in the GameServer SDK to the Pod Sidecar -service SDK {} \ No newline at end of file +service SDK { + // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. + rpc GetCounter(GetCounterRequest) returns (Counter) { + option (google.api.http) = { + get: "/v1beta1/counters/{name}" + }; + option (google.api.method_signature) = "name"; + } + + // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). + // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. + rpc UpdateCounter(UpdateCounterRequest) returns (Counter) { + option (google.api.http) = { + patch: "/v1beta1/counters/{counterUpdateRequest.name}" + body: "counterUpdateRequest" + }; + option (google.api.method_signature) = "counterUpdateRequest"; + } + + // Gets a List. Returns NOT_FOUND if the List does not exist. + rpc GetList(GetListRequest) returns (List) { + option (google.api.http) = { + get: "/v1beta1/lists/{name}" + }; + option (google.api.method_signature) = "name"; + } + + // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). + // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** + // Use AddListValue() or RemoveListValue() for modifying the List.Values field. + // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. + // If a field mask path(s) is specified, but the value is not set in the request List object, + // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). + rpc UpdateList(UpdateListRequest) returns (List) { + option (google.api.http) = { + patch: "/v1beta1/lists/{list.name}" + body: "list" + }; + option (google.api.method_signature) = "list,update_mask"; + } + + // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns ALREADY_EXISTS if the value is already in the List. + // Returns OUT_OF_RANGE if the List is already at Capacity. + rpc AddListValue(AddListValueRequest) returns (List) { + option (google.api.http) = { + post: "/v1beta1/lists/{name}:addValue" + body: "*" + }; + } + + // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns NOT_FOUND if the value is not in the List. + rpc RemoveListValue(RemoveListValueRequest) returns (List) { + option (google.api.http) = { + post: "/v1beta1/lists/{name}:removeValue" + body: "*" + }; + } +} + +// I am Empty +message Empty { +} + +// A representation of a Counter. +message Counter { + option (google.api.resource) = { + type: "agones.dev/Counter" + pattern: "counters/{counter}" + }; + // The name of the Counter + string name = 1; + // The current count of the Counter + int64 count = 2; + // The maximum capacity of the Counter + int64 capacity = 3; +} + +// A representation of a Counter Update Request. +message CounterUpdateRequest { + option (google.api.resource) = { + type: "agones.dev/CounterUpdateRequest" + pattern: "counterUpdateRequests/{counterUpdateRequest}" + }; + // The name of the Counter to update + string name = 1; + // The value to set the Counter Count + google.protobuf.Int64Value count = 2; + // The value to set the Counter Capacity + google.protobuf.Int64Value capacity = 3; + // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement + // (negative), 0 if a CountSet or CapacitySet request + int64 countDiff = 4; +} + +message GetCounterRequest { + // The name of the Counter to get + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/Counter" + }]; +} + +message UpdateCounterRequest { + // The requested update to make to the Counter + CounterUpdateRequest counterUpdateRequest = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/CounterUpdateRequest" + }]; +} + +// A representation of a List. +message List { + option (google.api.resource) = { + type: "agones.dev/List" + pattern: "lists/{list}" + }; + // The name of the List + string name = 1; + // The maximum capacity of the List + int64 capacity = 2; + // The array of items in the List ["v1", "v2", …] + repeated string values = 3; +} + +message GetListRequest { + // The name of the List to get + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; +} + +message UpdateListRequest { + // The List to update + List list = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + // Required. Mask (list) of fields to update. + // Fields are specified relative to the List + // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message AddListValueRequest { + // The name of the List to add a value to. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message RemoveListValueRequest { + // The name of the List to remove a value from. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} \ No newline at end of file diff --git a/proto/sdk/sdk.proto b/proto/sdk/sdk.proto index 2c210c3454..6504c64654 100644 --- a/proto/sdk/sdk.proto +++ b/proto/sdk/sdk.proto @@ -167,14 +167,14 @@ message GameServer { repeated string ids = 3; } - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] message CounterStatus { int64 count = 1; int64 capacity = 2; } - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] message ListStatus { int64 capacity = 1; @@ -190,11 +190,11 @@ message GameServer { // [FeatureFlag:PlayerTracking] PlayerStatus players = 4; - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] map counters = 5; - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] map lists = 6; } diff --git a/sdks/csharp/proto/sdk/alpha/alpha.proto b/sdks/csharp/proto/sdk/alpha/alpha.proto index 761637a90d..0c5594ed23 100644 --- a/sdks/csharp/proto/sdk/alpha/alpha.proto +++ b/sdks/csharp/proto/sdk/alpha/alpha.proto @@ -18,12 +18,6 @@ package agones.dev.sdk.alpha; option go_package = "./alpha"; import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; @@ -126,65 +120,6 @@ service SDK { get: "/alpha/player/connected" }; } - - // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. - rpc GetCounter(GetCounterRequest) returns (Counter) { - option (google.api.http) = { - get: "/v1alpha1/counters/{name}" - }; - option (google.api.method_signature) = "name"; - } - - // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). - // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. - rpc UpdateCounter(UpdateCounterRequest) returns (Counter) { - option (google.api.http) = { - patch: "/v1alpha1/counters/{counterUpdateRequest.name}" - body: "counterUpdateRequest" - }; - option (google.api.method_signature) = "counterUpdateRequest"; - } - - // Gets a List. Returns NOT_FOUND if the List does not exist. - rpc GetList(GetListRequest) returns (List) { - option (google.api.http) = { - get: "/v1alpha1/lists/{name}" - }; - option (google.api.method_signature) = "name"; - } - - // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). - // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** - // Use AddListValue() or RemoveListValue() for modifying the List.Values field. - // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. - // If a field mask path(s) is specified, but the value is not set in the request List object, - // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). - rpc UpdateList(UpdateListRequest) returns (List) { - option (google.api.http) = { - patch: "/v1alpha1/lists/{list.name}" - body: "list" - }; - option (google.api.method_signature) = "list,update_mask"; - } - - // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns ALREADY_EXISTS if the value is already in the List. - // Returns OUT_OF_RANGE if the List is already at Capacity. - rpc AddListValue(AddListValueRequest) returns (List) { - option (google.api.http) = { - post: "/v1alpha1/lists/{name}:addValue" - body: "*" - }; - } - - // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns NOT_FOUND if the value is not in the List. - rpc RemoveListValue(RemoveListValueRequest) returns (List) { - option (google.api.http) = { - post: "/v1alpha1/lists/{name}:removeValue" - body: "*" - }; - } } // I am Empty @@ -210,111 +145,3 @@ message PlayerID { message PlayerIDList { repeated string list = 1; } - -// A representation of a Counter. -message Counter { - option (google.api.resource) = { - type: "agones.dev/Counter" - pattern: "counters/{counter}" - }; - // The name of the Counter - string name = 1; - // The current count of the Counter - int64 count = 2; - // The maximum capacity of the Counter - int64 capacity = 3; -} - -// A representation of a Counter Update Request. -message CounterUpdateRequest { - option (google.api.resource) = { - type: "agones.dev/CounterUpdateRequest" - pattern: "counterUpdateRequests/{counterUpdateRequest}" - }; - // The name of the Counter to update - string name = 1; - // The value to set the Counter Count - google.protobuf.Int64Value count = 2; - // The value to set the Counter Capacity - google.protobuf.Int64Value capacity = 3; - // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement - // (negative), 0 if a CountSet or CapacitySet request - int64 countDiff = 4; -} - -message GetCounterRequest { - // The name of the Counter to get - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/Counter" - }]; -} - -message UpdateCounterRequest { - // The requested update to make to the Counter - CounterUpdateRequest counterUpdateRequest = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/CounterUpdateRequest" - }]; -} - -// A representation of a List. -message List { - option (google.api.resource) = { - type: "agones.dev/List" - pattern: "lists/{list}" - }; - // The name of the List - string name = 1; - // The maximum capacity of the List - int64 capacity = 2; - // The array of items in the List ["v1", "v2", …] - repeated string values = 3; -} - -message GetListRequest { - // The name of the List to get - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; -} - -message UpdateListRequest { - // The List to update - List list = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - // Required. Mask (list) of fields to update. - // Fields are specified relative to the List - // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message AddListValueRequest { - // The name of the List to add a value to. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message RemoveListValueRequest { - // The name of the List to remove a value from. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/sdks/csharp/proto/sdk/beta/beta.proto b/sdks/csharp/proto/sdk/beta/beta.proto index d0ef73fc57..b0e5593f76 100644 --- a/sdks/csharp/proto/sdk/beta/beta.proto +++ b/sdks/csharp/proto/sdk/beta/beta.proto @@ -18,17 +18,192 @@ package agones.dev.sdk.beta; option go_package = "./beta"; import "google/api/annotations.proto"; -import "protoc-gen-openapiv2/options/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; + + + + + + + + -option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { - info: { - title: "beta.proto"; - version: "version not set"; - }; - schemes: HTTP; - consumes: "application/json"; - produces: "application/json"; -}; // SDK service to be used in the GameServer SDK to the Pod Sidecar -service SDK {} \ No newline at end of file +service SDK { + // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. + rpc GetCounter(GetCounterRequest) returns (Counter) { + option (google.api.http) = { + get: "/v1beta1/counters/{name}" + }; + option (google.api.method_signature) = "name"; + } + + // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). + // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. + rpc UpdateCounter(UpdateCounterRequest) returns (Counter) { + option (google.api.http) = { + patch: "/v1beta1/counters/{counterUpdateRequest.name}" + body: "counterUpdateRequest" + }; + option (google.api.method_signature) = "counterUpdateRequest"; + } + + // Gets a List. Returns NOT_FOUND if the List does not exist. + rpc GetList(GetListRequest) returns (List) { + option (google.api.http) = { + get: "/v1beta1/lists/{name}" + }; + option (google.api.method_signature) = "name"; + } + + // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). + // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** + // Use AddListValue() or RemoveListValue() for modifying the List.Values field. + // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. + // If a field mask path(s) is specified, but the value is not set in the request List object, + // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). + rpc UpdateList(UpdateListRequest) returns (List) { + option (google.api.http) = { + patch: "/v1beta1/lists/{list.name}" + body: "list" + }; + option (google.api.method_signature) = "list,update_mask"; + } + + // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns ALREADY_EXISTS if the value is already in the List. + // Returns OUT_OF_RANGE if the List is already at Capacity. + rpc AddListValue(AddListValueRequest) returns (List) { + option (google.api.http) = { + post: "/v1beta1/lists/{name}:addValue" + body: "*" + }; + } + + // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns NOT_FOUND if the value is not in the List. + rpc RemoveListValue(RemoveListValueRequest) returns (List) { + option (google.api.http) = { + post: "/v1beta1/lists/{name}:removeValue" + body: "*" + }; + } +} + +// I am Empty +message Empty { +} + +// A representation of a Counter. +message Counter { + option (google.api.resource) = { + type: "agones.dev/Counter" + pattern: "counters/{counter}" + }; + // The name of the Counter + string name = 1; + // The current count of the Counter + int64 count = 2; + // The maximum capacity of the Counter + int64 capacity = 3; +} + +// A representation of a Counter Update Request. +message CounterUpdateRequest { + option (google.api.resource) = { + type: "agones.dev/CounterUpdateRequest" + pattern: "counterUpdateRequests/{counterUpdateRequest}" + }; + // The name of the Counter to update + string name = 1; + // The value to set the Counter Count + google.protobuf.Int64Value count = 2; + // The value to set the Counter Capacity + google.protobuf.Int64Value capacity = 3; + // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement + // (negative), 0 if a CountSet or CapacitySet request + int64 countDiff = 4; +} + +message GetCounterRequest { + // The name of the Counter to get + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/Counter" + }]; +} + +message UpdateCounterRequest { + // The requested update to make to the Counter + CounterUpdateRequest counterUpdateRequest = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/CounterUpdateRequest" + }]; +} + +// A representation of a List. +message List { + option (google.api.resource) = { + type: "agones.dev/List" + pattern: "lists/{list}" + }; + // The name of the List + string name = 1; + // The maximum capacity of the List + int64 capacity = 2; + // The array of items in the List ["v1", "v2", …] + repeated string values = 3; +} + +message GetListRequest { + // The name of the List to get + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; +} + +message UpdateListRequest { + // The List to update + List list = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + // Required. Mask (list) of fields to update. + // Fields are specified relative to the List + // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message AddListValueRequest { + // The name of the List to add a value to. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message RemoveListValueRequest { + // The name of the List to remove a value from. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} \ No newline at end of file diff --git a/sdks/csharp/proto/sdk/sdk.proto b/sdks/csharp/proto/sdk/sdk.proto index 96d7fc9aa2..2f3351eb08 100644 --- a/sdks/csharp/proto/sdk/sdk.proto +++ b/sdks/csharp/proto/sdk/sdk.proto @@ -165,14 +165,14 @@ message GameServer { repeated string ids = 3; } - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] message CounterStatus { int64 count = 1; int64 capacity = 2; } - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] message ListStatus { int64 capacity = 1; @@ -188,11 +188,11 @@ message GameServer { // [FeatureFlag:PlayerTracking] PlayerStatus players = 4; - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] map counters = 5; - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] map lists = 6; } diff --git a/sdks/csharp/sdk/AgonesSDK.cs b/sdks/csharp/sdk/AgonesSDK.cs index c66d187d96..c40f9e6e51 100644 --- a/sdks/csharp/sdk/AgonesSDK.cs +++ b/sdks/csharp/sdk/AgonesSDK.cs @@ -34,6 +34,7 @@ public sealed class AgonesSDK : IAgonesSDK internal SDK.SDKClient client; internal readonly Alpha alpha; + internal readonly Beta beta; internal readonly GrpcChannel channel; internal AsyncClientStreamingCall healthStream; internal readonly CancellationTokenSource cts; @@ -81,6 +82,7 @@ public AgonesSDK( client = sdkClient ?? new SDK.SDKClient(channel); alpha = new Alpha(channel, requestTimeoutSec, cancellationTokenSource, logger); + beta = new Beta(channel, requestTimeoutSec, cancellationTokenSource, logger); } /// @@ -92,6 +94,17 @@ public IAgonesAlphaSDK Alpha() return alpha; } + /// + /// Beta returns the AlphBeta SDK + /// + /// Agones beta SDK + public IAgonesBetaSDK Beta() + { + return beta; + } + + + /// /// Connect the underlying gRPC channel. /// diff --git a/sdks/csharp/sdk/Alpha.cs b/sdks/csharp/sdk/Alpha.cs index 5e38611bfc..294c1c7337 100644 --- a/sdks/csharp/sdk/Alpha.cs +++ b/sdks/csharp/sdk/Alpha.cs @@ -211,361 +211,6 @@ public async Task> GetConnectedPlayersAsync() } } - /// - /// GetCounterCountAsync returns the Count for a Counter, given the Counter's key (name). - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - /// The Counter's Count - public async Task GetCounterCountAsync(string key) - { - try - { - var request = new GetCounterRequest() - { - Name = key, - }; - var counter = await client.GetCounterAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return counter.Count; - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke GetCounterCount({key})."); - throw; - } - } - - /// - /// IncrementCounterAsync increases a counter by the given nonnegative integer amount. - /// Will execute the increment operation against the current CRD value. Will max at max(int64). - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// Throws error if the count is at the current capacity (to the latest knowledge of the SDK), - /// and no increment will occur. - /// - /// Note: A potential race condition here is that if count values are set from both the SDK and - /// through the K8s API (Allocation or otherwise), since the SDK append operation back to the CRD - /// value is batched asynchronous any value incremented past the capacity will be silently truncated. - /// - public async Task IncrementCounterAsync(string key, long amount) - { - if (amount < 0) - { - throw new ArgumentOutOfRangeException($"CountIncrement amount must be a positive number, found {amount}"); - } - try - { - var request = new CounterUpdateRequest() - { - Name = key, - CountDiff = amount, - }; - var updateRequest = new UpdateCounterRequest() - { - CounterUpdateRequest = request, - }; - await client.UpdateCounterAsync(updateRequest, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - // If there is no error, then the request was successful. - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke IncrementCounter({key}, {amount})."); - throw; - } - } - - /// - /// DecrementCounterAsync decreases the current count by the given nonnegative integer amount. - /// The Counter will not go below 0. Will execute the decrement operation against the current CRD value. - /// Throws error if the count is at 0 (to the latest knowledge of the SDK), and no decrement will occur. - /// - public async Task DecrementCounterAsync(string key, long amount) - { - if (amount < 0) - { - throw new ArgumentOutOfRangeException($"DecrementCounter amount must be a positive number, found {amount}"); - } - try - { - var request = new CounterUpdateRequest() - { - Name = key, - CountDiff = amount * -1, - }; - var updateRequest = new UpdateCounterRequest() - { - CounterUpdateRequest = request, - }; - await client.UpdateCounterAsync(updateRequest, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke DecrementCounter({key}, {amount})."); - throw; - } - } - - /// - /// SetCounterCountAsync sets a count to the given value. Use with care, as this will - /// overwrite any previous invocations’ value. Cannot be greater than Capacity. - /// - public async Task SetCounterCountAsync(string key, long amount) - { - try - { - var request = new CounterUpdateRequest() - { - Name = key, - Count = amount, - }; - var updateRequest = new UpdateCounterRequest() - { - CounterUpdateRequest = request, - }; - await client.UpdateCounterAsync(updateRequest, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke SetCounterCount({key}, {amount})."); - throw; - } - } - - /// - /// GetCounterCapacityAsync returns the Capacity for a Counter, given the Counter's key (name). - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - /// The Counter's capacity - public async Task GetCounterCapacityAsync(string key) - { - try - { - var request = new GetCounterRequest() - { - Name = key, - }; - var counter = await client.GetCounterAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return counter.Capacity; - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke GetCounterCapacity({key})."); - throw; - } - } - - /// - /// SetCounterCapacityAsync sets the capacity for the given Counter. - /// A capacity of 0 is no capacity. - /// - public async Task SetCounterCapacityAsync(string key, long amount) - { - try - { - var request = new CounterUpdateRequest() - { - Name = key, - Capacity = amount, - }; - var updateRequest = new UpdateCounterRequest() - { - CounterUpdateRequest = request, - }; - await client.UpdateCounterAsync(updateRequest, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke SetCounterCapacity({key}, {amount})."); - throw; - } - } - - /// - /// GetListCapacityAsync returns the Capacity for a List, given the List's key (name). - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - /// The List's capacity - public async Task GetListCapacityAsync(string key) - { - try - { - var request = new GetListRequest() - { - Name = key, - }; - var list = await client.GetListAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return list.Capacity; - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke GetListCapacity({key})."); - throw; - } - } - - /// - /// SetListCapacityAsync sets the capacity for a given list. Capacity must be between 0 and 1000. - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - public async Task SetListCapacityAsync(string key, long amount) - { - try - { - var list = new List() - { - Name = key, - Capacity = amount, - }; - // FieldMask to update the capacity field only - var updateMask = new gProto.FieldMask() - { - Paths = { "capacity" }, - }; - var request = new UpdateListRequest() - { - List = list, - UpdateMask = updateMask, - }; - await client.UpdateListAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke SetListCapacity({key}, {amount})."); - throw; - } - } - - /// - /// ListContainsAsync returns if a string exists in a List's values list, given the List's key - /// and the string value. Search is case-sensitive. - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - /// True if the value is found in the List - public async Task ListContainsAsync(string key, string value) - { - try - { - var request = new GetListRequest() - { - Name = key, - }; - var list = await client.GetListAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - if (list.Values.Contains(value)) - { - return true; - }; - return false; - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke ListContains({key}, {value})."); - throw; - } - } - - /// - /// GetListLengthAsync returns the length of the Values list for a List, given the List's key. - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - /// The length of List's values array - public async Task GetListLengthAsync(string key) - { - try - { - var request = new GetListRequest() - { - Name = key, - }; - var list = await client.GetListAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return list.Values.Count; - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke GetListLength({key})."); - throw; - } - } - - /// - /// GetListValuesAsync returns the Values for a List, given the List's key (name). - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - /// The List's values array - public async Task> GetListValuesAsync(string key) - { - try - { - var request = new GetListRequest() - { - Name = key, - }; - var list = await client.GetListAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - return list.Values; - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke GetListValues({key})."); - throw; - } - } - - /// - /// AppendListValueAsync appends a string to a List's values list, given the List's key (name) - /// and the string value. Throws error if the string already exists in the list. - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - public async Task AppendListValueAsync(string key, string value) - { - try - { - var request = new AddListValueRequest() - { - Name = key, - Value = value, - }; - await client.AddListValueAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke AppendListValue({key}, {value})."); - throw; - } - } - - /// - /// DeleteListValueAsync removes a string from a List's values list, given the List's key - /// and the string value. Throws error if the string does not exist in the list. - /// Throws error if the key was not predefined in the GameServer resource on creation. - /// - public async Task DeleteListValueAsync(string key, string value) - { - try - { - var request = new RemoveListValueRequest() - { - Name = key, - Value = value, - }; - await client.RemoveListValueAsync(request, - deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); - } - catch (RpcException ex) - { - LogError(ex, $"Unable to invoke DeleteListValue({key}, {value})."); - throw; - } - } - public void Dispose() { if (_disposed) diff --git a/sdks/csharp/sdk/Beta.cs b/sdks/csharp/sdk/Beta.cs new file mode 100644 index 0000000000..5087f00533 --- /dev/null +++ b/sdks/csharp/sdk/Beta.cs @@ -0,0 +1,447 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using Agones.Dev.Sdk.Beta; +using Grpc.Core; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Net.Client; +using gProto = Google.Protobuf.WellKnownTypes; + +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Agones.Test")] +namespace Agones +{ + public sealed class Beta : IAgonesBetaSDK + { + + /// + /// The timeout for gRPC calls. + /// + public double RequestTimeoutSec { get; set; } + + internal SDK.SDKClient client; + internal readonly IClientStreamWriter healthStream; + internal readonly CancellationTokenSource cts; + internal readonly bool ownsCts; + internal CancellationToken ctoken; + + private readonly ILogger _logger; + private bool _disposed; + + public Beta( + GrpcChannel channel, + double requestTimeoutSec = 15, + CancellationTokenSource cancellationTokenSource = null, + ILogger logger = null) + { + _logger = logger; + RequestTimeoutSec = requestTimeoutSec; + + if (cancellationTokenSource == null) + { + cts = new CancellationTokenSource(); + ownsCts = true; + } + else + { + cts = cancellationTokenSource; + ownsCts = false; + } + + ctoken = cts.Token; + client = new SDK.SDKClient(channel); + } + + /// + /// GetCounterCountAsync returns the Count for a Counter, given the Counter's key (name). + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + /// The Counter's Count + public async Task GetCounterCountAsync(string key) + { + try + { + var request = new GetCounterRequest() + { + Name = key, + }; + var counter = await client.GetCounterAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + return counter.Count; + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke GetCounterCount({key})."); + throw; + } + } + + /// + /// IncrementCounterAsync increases a counter by the given nonnegative integer amount. + /// Will execute the increment operation against the current CRD value. Will max at max(int64). + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// Throws error if the count is at the current capacity (to the latest knowledge of the SDK), + /// and no increment will occur. + /// + /// Note: A potential race condition here is that if count values are set from both the SDK and + /// through the K8s API (Allocation or otherwise), since the SDK append operation back to the CRD + /// value is batched asynchronous any value incremented past the capacity will be silently truncated. + /// + public async Task IncrementCounterAsync(string key, long amount) + { + if (amount < 0) + { + throw new ArgumentOutOfRangeException($"CountIncrement amount must be a positive number, found {amount}"); + } + try + { + var request = new CounterUpdateRequest() + { + Name = key, + CountDiff = amount, + }; + var updateRequest = new UpdateCounterRequest() + { + CounterUpdateRequest = request, + }; + await client.UpdateCounterAsync(updateRequest, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + // If there is no error, then the request was successful. + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke IncrementCounter({key}, {amount})."); + throw; + } + } + + /// + /// DecrementCounterAsync decreases the current count by the given nonnegative integer amount. + /// The Counter will not go below 0. Will execute the decrement operation against the current CRD value. + /// Throws error if the count is at 0 (to the latest knowledge of the SDK), and no decrement will occur. + /// + public async Task DecrementCounterAsync(string key, long amount) + { + if (amount < 0) + { + throw new ArgumentOutOfRangeException($"DecrementCounter amount must be a positive number, found {amount}"); + } + try + { + var request = new CounterUpdateRequest() + { + Name = key, + CountDiff = amount * -1, + }; + var updateRequest = new UpdateCounterRequest() + { + CounterUpdateRequest = request, + }; + await client.UpdateCounterAsync(updateRequest, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke DecrementCounter({key}, {amount})."); + throw; + } + } + + /// + /// SetCounterCountAsync sets a count to the given value. Use with care, as this will + /// overwrite any previous invocations’ value. Cannot be greater than Capacity. + /// + public async Task SetCounterCountAsync(string key, long amount) + { + try + { + var request = new CounterUpdateRequest() + { + Name = key, + Count = amount, + }; + var updateRequest = new UpdateCounterRequest() + { + CounterUpdateRequest = request, + }; + await client.UpdateCounterAsync(updateRequest, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke SetCounterCount({key}, {amount})."); + throw; + } + } + + /// + /// GetCounterCapacityAsync returns the Capacity for a Counter, given the Counter's key (name). + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + /// The Counter's capacity + public async Task GetCounterCapacityAsync(string key) + { + try + { + var request = new GetCounterRequest() + { + Name = key, + }; + var counter = await client.GetCounterAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + return counter.Capacity; + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke GetCounterCapacity({key})."); + throw; + } + } + + /// + /// SetCounterCapacityAsync sets the capacity for the given Counter. + /// A capacity of 0 is no capacity. + /// + public async Task SetCounterCapacityAsync(string key, long amount) + { + try + { + var request = new CounterUpdateRequest() + { + Name = key, + Capacity = amount, + }; + var updateRequest = new UpdateCounterRequest() + { + CounterUpdateRequest = request, + }; + await client.UpdateCounterAsync(updateRequest, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke SetCounterCapacity({key}, {amount})."); + throw; + } + } + + /// + /// GetListCapacityAsync returns the Capacity for a List, given the List's key (name). + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + /// The List's capacity + public async Task GetListCapacityAsync(string key) + { + try + { + var request = new GetListRequest() + { + Name = key, + }; + var list = await client.GetListAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + return list.Capacity; + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke GetListCapacity({key})."); + throw; + } + } + + /// + /// SetListCapacityAsync sets the capacity for a given list. Capacity must be between 0 and 1000. + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + public async Task SetListCapacityAsync(string key, long amount) + { + try + { + var list = new List() + { + Name = key, + Capacity = amount, + }; + // FieldMask to update the capacity field only + var updateMask = new gProto.FieldMask() + { + Paths = { "capacity" }, + }; + var request = new UpdateListRequest() + { + List = list, + UpdateMask = updateMask, + }; + await client.UpdateListAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke SetListCapacity({key}, {amount})."); + throw; + } + } + + /// + /// ListContainsAsync returns if a string exists in a List's values list, given the List's key + /// and the string value. Search is case-sensitive. + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + /// True if the value is found in the List + public async Task ListContainsAsync(string key, string value) + { + try + { + var request = new GetListRequest() + { + Name = key, + }; + var list = await client.GetListAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + if (list.Values.Contains(value)) + { + return true; + }; + return false; + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke ListContains({key}, {value})."); + throw; + } + } + + /// + /// GetListLengthAsync returns the length of the Values list for a List, given the List's key. + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + /// The length of List's values array + public async Task GetListLengthAsync(string key) + { + try + { + var request = new GetListRequest() + { + Name = key, + }; + var list = await client.GetListAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + return list.Values.Count; + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke GetListLength({key})."); + throw; + } + } + + /// + /// GetListValuesAsync returns the Values for a List, given the List's key (name). + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + /// The List's values array + public async Task> GetListValuesAsync(string key) + { + try + { + var request = new GetListRequest() + { + Name = key, + }; + var list = await client.GetListAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + return list.Values; + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke GetListValues({key})."); + throw; + } + } + + /// + /// AppendListValueAsync appends a string to a List's values list, given the List's key (name) + /// and the string value. Throws error if the string already exists in the list. + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + public async Task AppendListValueAsync(string key, string value) + { + try + { + var request = new AddListValueRequest() + { + Name = key, + Value = value, + }; + await client.AddListValueAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke AppendListValue({key}, {value})."); + throw; + } + } + + /// + /// DeleteListValueAsync removes a string from a List's values list, given the List's key + /// and the string value. Throws error if the string does not exist in the list. + /// Throws error if the key was not predefined in the GameServer resource on creation. + /// + public async Task DeleteListValueAsync(string key, string value) + { + try + { + var request = new RemoveListValueRequest() + { + Name = key, + Value = value, + }; + await client.RemoveListValueAsync(request, + deadline: DateTime.UtcNow.AddSeconds(RequestTimeoutSec), cancellationToken: ctoken); + } + catch (RpcException ex) + { + LogError(ex, $"Unable to invoke DeleteListValue({key}, {value})."); + throw; + } + } + + public void Dispose() + { + if (_disposed) + { + return; + } + + cts.Cancel(); + + if (ownsCts) + { + cts.Dispose(); + } + + _disposed = true; + GC.SuppressFinalize(this); + } + + private void LogError(Exception ex, string message) + { + _logger?.LogError(ex, message); + } + } +} diff --git a/sdks/csharp/sdk/IAgonesAlphaSDK.cs b/sdks/csharp/sdk/IAgonesAlphaSDK.cs index 8a7ae4a027..0117920b52 100644 --- a/sdks/csharp/sdk/IAgonesAlphaSDK.cs +++ b/sdks/csharp/sdk/IAgonesAlphaSDK.cs @@ -28,18 +28,5 @@ public interface IAgonesAlphaSDK : IDisposable Task GetPlayerCountAsync(); Task IsPlayerConnectedAsync(string id); Task> GetConnectedPlayersAsync(); - Task GetCounterCountAsync(string key); - Task IncrementCounterAsync(string key, long amount); - Task DecrementCounterAsync(string key, long amount); - Task SetCounterCountAsync(string key, long amount); - Task GetCounterCapacityAsync(string key); - Task SetCounterCapacityAsync(string key, long amount); - Task GetListCapacityAsync(string key); - Task SetListCapacityAsync(string key, long amount); - Task ListContainsAsync(string key, string value); - Task GetListLengthAsync(string key); - Task> GetListValuesAsync(string key); - Task AppendListValueAsync(string key, string value); - Task DeleteListValueAsync(string key, string value); } } diff --git a/sdks/csharp/sdk/IAgonesBetaSDK.cs b/sdks/csharp/sdk/IAgonesBetaSDK.cs new file mode 100644 index 0000000000..9f255af16f --- /dev/null +++ b/sdks/csharp/sdk/IAgonesBetaSDK.cs @@ -0,0 +1,38 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Grpc.Core; + +namespace Agones +{ + public interface IAgonesBetaSDK : IDisposable + { + Task GetCounterCountAsync(string key); + Task IncrementCounterAsync(string key, long amount); + Task DecrementCounterAsync(string key, long amount); + Task SetCounterCountAsync(string key, long amount); + Task GetCounterCapacityAsync(string key); + Task SetCounterCapacityAsync(string key, long amount); + Task GetListCapacityAsync(string key); + Task SetListCapacityAsync(string key, long amount); + Task ListContainsAsync(string key, string value); + Task GetListLengthAsync(string key); + Task> GetListValuesAsync(string key); + Task AppendListValueAsync(string key, string value); + Task DeleteListValueAsync(string key, string value); + } +} diff --git a/sdks/csharp/sdk/IAgonesSDK.cs b/sdks/csharp/sdk/IAgonesSDK.cs index fc826dbef2..7237ee24d8 100644 --- a/sdks/csharp/sdk/IAgonesSDK.cs +++ b/sdks/csharp/sdk/IAgonesSDK.cs @@ -32,5 +32,6 @@ public interface IAgonesSDK : IDisposable Task SetAnnotationAsync(string key, string value); Task HealthAsync(); IAgonesAlphaSDK Alpha(); + IAgonesBetaSDK Beta(); } } \ No newline at end of file diff --git a/sdks/csharp/sdk/csharp-sdk.csproj b/sdks/csharp/sdk/csharp-sdk.csproj index cabfa32b79..effbcf3900 100644 --- a/sdks/csharp/sdk/csharp-sdk.csproj +++ b/sdks/csharp/sdk/csharp-sdk.csproj @@ -31,6 +31,6 @@ - + diff --git a/sdks/csharp/test/AgonesAlphaSDKClientTests.cs b/sdks/csharp/test/AgonesAlphaSDKClientTests.cs index 476773347f..e2dfbafce2 100644 --- a/sdks/csharp/test/AgonesAlphaSDKClientTests.cs +++ b/sdks/csharp/test/AgonesAlphaSDKClientTests.cs @@ -137,378 +137,6 @@ public async Task GetConnectedPlayers_Sends_OK() CollectionAssert.AreEquivalent(expected, result); } - [TestMethod] - public async Task GetCounterCountAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "counterKey"; - long wantCount = 1; - var counter = new Counter() - { - Name = key, - Count = wantCount, - }; - var expected = new GetCounterRequest() - { - Name = key, - }; - // TODO: Remove comments - // https://github.com/devlooped/moq/wiki/Quickstart#async-methods - // Task DoSomethingAsync(); - // mock.Setup(foo => foo.DoSomethingAsync().Result).Returns(true); - // https://grpc.github.io/grpc/csharp/api/Grpc.Core.AsyncUnaryCall-1.html - // public AsyncUnaryCall(Task responseAsync, Task responseHeadersAsync, Func getStatusFunc, Func getTrailersFunc, Action disposeAction) - mockClient.Setup(m => m.GetCounterAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (GetCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var response = await mockSdk.Alpha().GetCounterCountAsync(key); - Assert.AreEqual(wantCount, response); - } - - [TestMethod] - public async Task IncrementCounterAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "counterKey"; - var amount = 9; - var counter = new Counter(); - var updateReq = new CounterUpdateRequest() - { - Name = key, - CountDiff = amount, - }; - var expected = new UpdateCounterRequest() - { - CounterUpdateRequest = updateReq, - }; - - mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().IncrementCounterAsync(key, amount); - } - - [TestMethod] - public async Task DecrementCounterAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "counterKey"; - var counter = new Counter(); - var updateReq = new CounterUpdateRequest() - { - Name = key, - CountDiff = -9, - }; - var expected = new UpdateCounterRequest() - { - CounterUpdateRequest = updateReq, - }; - - mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().DecrementCounterAsync(key, 9); - } - - [TestMethod] - public async Task SetCounterCountAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "counterKey"; - var amount = 99; - var counter = new Counter(); - var updateReq = new CounterUpdateRequest() - { - Name = key, - Count = amount, - }; - var expected = new UpdateCounterRequest() - { - CounterUpdateRequest = updateReq, - }; - - mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().SetCounterCountAsync(key, amount); - } - - [TestMethod] - public async Task GetCounterCapacityAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "counterKey"; - long wantCapacity = 11; - var counter = new Counter() - { - Name = key, - Capacity = wantCapacity, - }; - var expected = new GetCounterRequest() - { - Name = key, - }; - - mockClient.Setup(m => m.GetCounterAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (GetCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var response = await mockSdk.Alpha().GetCounterCapacityAsync(key); - Assert.AreEqual(wantCapacity, response); - } - - [TestMethod] - public async Task SetCounterCapacityAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "counterKey"; - var amount = 99; - var counter = new Counter(); - var updateReq = new CounterUpdateRequest() - { - Name = key, - Capacity = amount, - }; - var expected = new UpdateCounterRequest() - { - CounterUpdateRequest = updateReq, - }; - - mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().SetCounterCapacityAsync(key, amount); - } - - [TestMethod] - public async Task GetListCapacityAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - long wantCapacity = 999; - var list = new List() - { - Name = key, - Capacity = wantCapacity, - }; - var expected = new GetListRequest() - { - Name = key, - }; - - mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var response = await mockSdk.Alpha().GetListCapacityAsync(key); - Assert.AreEqual(wantCapacity, response); - } - - [TestMethod] - public async Task SetListCapacityAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - var amount = 99; - var list = new List() - { - Name = key, - Capacity = amount, - }; - var updateMask = new gProto.FieldMask() - { - Paths = { "capacity" }, - }; - var expected = new UpdateListRequest() - { - List = list, - UpdateMask = updateMask, - }; - - mockClient.Setup(m => m.UpdateListAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (UpdateListRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().SetListCapacityAsync(key, amount); - } - - [TestMethod] - public async Task ListContainsAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - var value = "foo"; - var list = new List() - { - Name = key, - }; - list.Values.Add(value); - var expected = new GetListRequest() - { - Name = key, - }; - - mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var response = await mockSdk.Alpha().ListContainsAsync(key, value); - Assert.AreEqual(true, response); - } - - [TestMethod] - public async Task AppendListValueAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - var value = "foo"; - var list = new List() - { - Name = key, - }; - var expected = new AddListValueRequest() - { - Name = key, - Value = value, - }; - - mockClient.Setup(m => m.AddListValueAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (AddListValueRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().AppendListValueAsync(key, value); - } - - [TestMethod] - public async Task DeleteListValueAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - var value = "foo"; - var list = new List() - { - Name = key, - }; - var expected = new RemoveListValueRequest() - { - Name = key, - Value = value, - }; - - mockClient.Setup(m => m.RemoveListValueAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (RemoveListValueRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - await mockSdk.Alpha().DeleteListValueAsync(key, value); - } - - [TestMethod] - public async Task GetListLengthAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - long wantLength = 3; - var values = new string[] { "foo", "bar", "baz" }; - var list = new List() - { - Name = key, - }; - list.Values.Add(values); - var expected = new GetListRequest() - { - Name = key, - }; - - mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - var response = await mockSdk.Alpha().GetListLengthAsync(key); - Assert.AreEqual(wantLength, response); - } - - [TestMethod] - public async Task GetListValuesAsync_Sends_OK() - { - var mockClient = new Mock(); - var mockSdk = new AgonesSDK(); - var key = "listKey"; - IList wantValues = new List { "foo", "bar", "baz" }; - var list = new List() - { - Name = key, - }; - list.Values.Add(wantValues); - var expected = new GetListRequest() - { - Name = key, - }; - - mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), - It.IsAny(), It.IsAny())).Returns( - (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => - new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), - () => Status.DefaultSuccess, () => new Metadata(), () => { })); - mockSdk.alpha.client = mockClient.Object; - - - var response = await mockSdk.Alpha().GetListValuesAsync(key); - Assert.IsTrue(Enumerable.SequenceEqual(wantValues, response)); - } - [TestMethod] public void InstantiateWithParameters_OK() { diff --git a/sdks/csharp/test/AgonesBetaSDKClientTests.cs b/sdks/csharp/test/AgonesBetaSDKClientTests.cs new file mode 100644 index 0000000000..b0c21262f6 --- /dev/null +++ b/sdks/csharp/test/AgonesBetaSDKClientTests.cs @@ -0,0 +1,431 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Agones.Dev.Sdk.Beta; +using Grpc.Core; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; +using System; +using Grpc.Net.Client; +using Microsoft.Extensions.Logging; +using gProto = Google.Protobuf.WellKnownTypes; + +namespace Agones.Tests +{ + [TestClass] + public class AgonesBetaSDKClientTests + { + [TestMethod] + public async Task GetCounterCountAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "counterKey"; + long wantCount = 1; + var counter = new Counter() + { + Name = key, + Count = wantCount, + }; + var expected = new GetCounterRequest() + { + Name = key, + }; + // TODO: Remove comments + // https://github.com/devlooped/moq/wiki/Quickstart#async-methods + // Task DoSomethingAsync(); + // mock.Setup(foo => foo.DoSomethingAsync().Result).Returns(true); + // https://grpc.github.io/grpc/csharp/api/Grpc.Core.AsyncUnaryCall-1.html + // public AsyncUnaryCall(Task responseAsync, Task responseHeadersAsync, Func getStatusFunc, Func getTrailersFunc, Action disposeAction) + mockClient.Setup(m => m.GetCounterAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (GetCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + var response = await mockSdk.Beta().GetCounterCountAsync(key); + Assert.AreEqual(wantCount, response); + } + + [TestMethod] + public async Task IncrementCounterAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "counterKey"; + var amount = 9; + var counter = new Counter(); + var updateReq = new CounterUpdateRequest() + { + Name = key, + CountDiff = amount, + }; + var expected = new UpdateCounterRequest() + { + CounterUpdateRequest = updateReq, + }; + + mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().IncrementCounterAsync(key, amount); + } + + [TestMethod] + public async Task DecrementCounterAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "counterKey"; + var counter = new Counter(); + var updateReq = new CounterUpdateRequest() + { + Name = key, + CountDiff = -9, + }; + var expected = new UpdateCounterRequest() + { + CounterUpdateRequest = updateReq, + }; + + mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().DecrementCounterAsync(key, 9); + } + + [TestMethod] + public async Task SetCounterCountAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "counterKey"; + var amount = 99; + var counter = new Counter(); + var updateReq = new CounterUpdateRequest() + { + Name = key, + Count = amount, + }; + var expected = new UpdateCounterRequest() + { + CounterUpdateRequest = updateReq, + }; + + mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().SetCounterCountAsync(key, amount); + } + + [TestMethod] + public async Task GetCounterCapacityAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "counterKey"; + long wantCapacity = 11; + var counter = new Counter() + { + Name = key, + Capacity = wantCapacity, + }; + var expected = new GetCounterRequest() + { + Name = key, + }; + + mockClient.Setup(m => m.GetCounterAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (GetCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + var response = await mockSdk.Beta().GetCounterCapacityAsync(key); + Assert.AreEqual(wantCapacity, response); + } + + [TestMethod] + public async Task SetCounterCapacityAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "counterKey"; + var amount = 99; + var counter = new Counter(); + var updateReq = new CounterUpdateRequest() + { + Name = key, + Capacity = amount, + }; + var expected = new UpdateCounterRequest() + { + CounterUpdateRequest = updateReq, + }; + + mockClient.Setup(m => m.UpdateCounterAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (UpdateCounterRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(counter), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().SetCounterCapacityAsync(key, amount); + } + + [TestMethod] + public async Task GetListCapacityAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + long wantCapacity = 999; + var list = new List() + { + Name = key, + Capacity = wantCapacity, + }; + var expected = new GetListRequest() + { + Name = key, + }; + + mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + var response = await mockSdk.Beta().GetListCapacityAsync(key); + Assert.AreEqual(wantCapacity, response); + } + + [TestMethod] + public async Task SetListCapacityAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + var amount = 99; + var list = new List() + { + Name = key, + Capacity = amount, + }; + var updateMask = new gProto.FieldMask() + { + Paths = { "capacity" }, + }; + var expected = new UpdateListRequest() + { + List = list, + UpdateMask = updateMask, + }; + + mockClient.Setup(m => m.UpdateListAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (UpdateListRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().SetListCapacityAsync(key, amount); + } + + [TestMethod] + public async Task ListContainsAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + var value = "foo"; + var list = new List() + { + Name = key, + }; + list.Values.Add(value); + var expected = new GetListRequest() + { + Name = key, + }; + + mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + var response = await mockSdk.Beta().ListContainsAsync(key, value); + Assert.AreEqual(true, response); + } + + [TestMethod] + public async Task AppendListValueAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + var value = "foo"; + var list = new List() + { + Name = key, + }; + var expected = new AddListValueRequest() + { + Name = key, + Value = value, + }; + + mockClient.Setup(m => m.AddListValueAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (AddListValueRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().AppendListValueAsync(key, value); + } + + [TestMethod] + public async Task DeleteListValueAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + var value = "foo"; + var list = new List() + { + Name = key, + }; + var expected = new RemoveListValueRequest() + { + Name = key, + Value = value, + }; + + mockClient.Setup(m => m.RemoveListValueAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (RemoveListValueRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + await mockSdk.Beta().DeleteListValueAsync(key, value); + } + + [TestMethod] + public async Task GetListLengthAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + long wantLength = 3; + var values = new string[] { "foo", "bar", "baz" }; + var list = new List() + { + Name = key, + }; + list.Values.Add(values); + var expected = new GetListRequest() + { + Name = key, + }; + + mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + var response = await mockSdk.Beta().GetListLengthAsync(key); + Assert.AreEqual(wantLength, response); + } + + [TestMethod] + public async Task GetListValuesAsync_Sends_OK() + { + var mockClient = new Mock(); + var mockSdk = new AgonesSDK(); + var key = "listKey"; + IList wantValues = new List { "foo", "bar", "baz" }; + var list = new List() + { + Name = key, + }; + list.Values.Add(wantValues); + var expected = new GetListRequest() + { + Name = key, + }; + + mockClient.Setup(m => m.GetListAsync(expected, It.IsAny(), + It.IsAny(), It.IsAny())).Returns( + (GetListRequest _, Metadata _, DateTime? _, CancellationToken _) => + new AsyncUnaryCall(Task.FromResult(list), Task.FromResult(new Metadata()), + () => Status.DefaultSuccess, () => new Metadata(), () => { })); + mockSdk.beta.client = mockClient.Object; + + + var response = await mockSdk.Beta().GetListValuesAsync(key); + Assert.IsTrue(Enumerable.SequenceEqual(wantValues, response)); + } + + [TestMethod] + public void InstantiateWithParameters_OK() + { + var mockSdk = new AgonesSDK(); + //var mockChannel = new Channel(mockSdk.Host, mockSdk.Port, ChannelCredentials.Insecure); + var mockChannel = GrpcChannel.ForAddress($"http://{mockSdk.Host}:{mockSdk.Port}"); + ILogger mockLogger = new Mock().Object; + CancellationTokenSource mockCancellationTokenSource = new Mock().Object; + bool exceptionOccured = false; + try + { + new Beta( + channel: mockChannel, + requestTimeoutSec: 15, + cancellationTokenSource: mockCancellationTokenSource, + logger: mockLogger + ); + } + catch + { + exceptionOccured = true; + } + + Assert.IsFalse(exceptionOccured); + } + } +} diff --git a/sdks/go/alpha.go b/sdks/go/alpha.go index 0dd26a293f..ac9b28201c 100644 --- a/sdks/go/alpha.go +++ b/sdks/go/alpha.go @@ -19,8 +19,6 @@ import ( "github.com/pkg/errors" "google.golang.org/grpc" - "google.golang.org/protobuf/types/known/fieldmaskpb" - "google.golang.org/protobuf/types/known/wrapperspb" "agones.dev/agones/pkg/sdk/alpha" ) @@ -85,176 +83,3 @@ func (a *Alpha) GetConnectedPlayers() ([]string, error) { list, err := a.client.GetConnectedPlayers(context.Background(), &alpha.Empty{}) return list.GetList(), errors.Wrap(err, "could not list connected players") } - -// GetCounterCount returns the Count for a Counter, given the Counter's key (name). -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) GetCounterCount(key string) (int64, error) { - counter, err := a.client.GetCounter(context.Background(), &alpha.GetCounterRequest{Name: key}) - if err != nil { - return -1, errors.Wrapf(err, "could not get Counter %s count", key) - } - return counter.Count, nil -} - -// IncrementCounter increases a counter by the given nonnegative integer amount. -// Will execute the increment operation against the current CRD value. Will max at max(int64). -// Will error if the key was not predefined in the GameServer resource on creation. -// Returns error if the count is at the current capacity (to the latest knowledge of the SDK), -// and no increment will occur. -// -// Note: A potential race condition here is that if count values are set from both the SDK and -// through the K8s API (Allocation or otherwise), since the SDK append operation back to the CRD -// value is batched asynchronous any value incremented past the capacity will be silently truncated. -func (a *Alpha) IncrementCounter(key string, amount int64) error { - if amount < 0 { - return errors.Errorf("amount must be a positive int64, found %d", amount) - } - _, err := a.client.UpdateCounter(context.Background(), &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ - Name: key, - CountDiff: amount, - }}) - if err != nil { - return errors.Wrapf(err, "could not increment Counter %s by amount %d", key, amount) - } - return nil -} - -// DecrementCounter decreases the current count by the given nonnegative integer amount. -// The Counter Will not go below 0. Will execute the decrement operation against the current CRD value. -// Will error if the count is at 0 (to the latest knowledge of the SDK), and no decrement will occur. -func (a *Alpha) DecrementCounter(key string, amount int64) error { - if amount < 0 { - return errors.Errorf("amount must be a positive int64, found %d", amount) - } - _, err := a.client.UpdateCounter(context.Background(), &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ - Name: key, - CountDiff: amount * -1, - }}) - if err != nil { - return errors.Wrapf(err, "could not decrement Counter %s by amount %d", key, amount) - } - return nil -} - -// SetCounterCount sets a count to the given value. Use with care, as this will overwrite any previous -// invocations’ value. Cannot be greater than Capacity. -func (a *Alpha) SetCounterCount(key string, amount int64) error { - _, err := a.client.UpdateCounter(context.Background(), &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ - Name: key, - Count: wrapperspb.Int64(amount), - }}) - if err != nil { - return errors.Wrapf(err, "could not set Counter %s count to amount %d", key, amount) - } - return nil -} - -// GetCounterCapacity returns the Capacity for a Counter, given the Counter's key (name). -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) GetCounterCapacity(key string) (int64, error) { - counter, err := a.client.GetCounter(context.Background(), &alpha.GetCounterRequest{Name: key}) - if err != nil { - return -1, errors.Wrapf(err, "could not get Counter %s capacity", key) - } - return counter.Capacity, nil -} - -// SetCounterCapacity sets the capacity for the given Counter. A capacity of 0 is no capacity. -func (a *Alpha) SetCounterCapacity(key string, amount int64) error { - _, err := a.client.UpdateCounter(context.Background(), &alpha.UpdateCounterRequest{ - CounterUpdateRequest: &alpha.CounterUpdateRequest{ - Name: key, - Capacity: wrapperspb.Int64(amount), - }}) - if err != nil { - return errors.Wrapf(err, "could not set Counter %s capacity to amount %d", key, amount) - } - return nil -} - -// GetListCapacity returns the Capacity for a List, given the List's key (name). -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) GetListCapacity(key string) (int64, error) { - list, err := a.client.GetList(context.Background(), &alpha.GetListRequest{Name: key}) - if err != nil { - return -1, errors.Wrapf(err, "could not get List %s", key) - } - return list.Capacity, nil -} - -// SetListCapacity sets the capacity for a given list. Capacity must be between 0 and 1000. -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) SetListCapacity(key string, amount int64) error { - _, err := a.client.UpdateList(context.Background(), &alpha.UpdateListRequest{ - List: &alpha.List{ - Name: key, - Capacity: amount, - }, - UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"capacity"}}, - }) - if err != nil { - return errors.Wrapf(err, "could not set List %s capacity to amount %d", key, amount) - } - return nil -} - -// ListContains returns if a string exists in a List's values list, given the List's key (name) -// and the string value. Search is case-sensitive. -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) ListContains(key, value string) (bool, error) { - list, err := a.client.GetList(context.Background(), &alpha.GetListRequest{Name: key}) - if err != nil { - return false, errors.Wrapf(err, "could not get List %s", key) - } - for _, val := range list.Values { - if val == value { - return true, nil - } - } - return false, nil -} - -// GetListLength returns the length of the Values list for a List, given the List's key (name). -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) GetListLength(key string) (int, error) { - list, err := a.client.GetList(context.Background(), &alpha.GetListRequest{Name: key}) - if err != nil { - return -1, errors.Wrapf(err, "could not get List %s", key) - } - return len(list.Values), nil -} - -// GetListValues returns the Values for a List, given the List's key (name). -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) GetListValues(key string) ([]string, error) { - list, err := a.client.GetList(context.Background(), &alpha.GetListRequest{Name: key}) - if err != nil { - return nil, errors.Wrapf(err, "could not get List %s", key) - } - return list.Values, nil -} - -// AppendListValue appends a string to a List's values list, given the List's key (name) -// and the string value. Will error if the string already exists in the list. -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) AppendListValue(key, value string) error { - _, err := a.client.AddListValue(context.Background(), &alpha.AddListValueRequest{Name: key, Value: value}) - if err != nil { - return errors.Wrapf(err, "could not get List %s", key) - } - return nil -} - -// DeleteListValue removes a string from a List's values list, given the List's key (name) -// and the string value. Will error if the string does not exist in the list. -// Will error if the key was not predefined in the GameServer resource on creation. -func (a *Alpha) DeleteListValue(key, value string) error { - _, err := a.client.RemoveListValue(context.Background(), &alpha.RemoveListValueRequest{Name: key, Value: value}) - if err != nil { - return errors.Wrapf(err, "could not get List %s", key) - } - return nil -} diff --git a/sdks/go/alpha_test.go b/sdks/go/alpha_test.go index b7068426fe..3100c1f7d9 100644 --- a/sdks/go/alpha_test.go +++ b/sdks/go/alpha_test.go @@ -18,7 +18,6 @@ import ( "context" "testing" - "github.com/pkg/errors" "github.com/stretchr/testify/assert" "google.golang.org/grpc" @@ -73,265 +72,11 @@ func TestAlphaGetAndSetPlayerCapacity(t *testing.T) { assert.Equal(t, []string{playerID}, list) } -func TestAlphaGetAndUpdateCounter(t *testing.T) { - mock := &alphaMock{} - // Counters must be predefined in the GameServer resource on creation. - mock.counters = make(map[string]*alpha.Counter) - - sessions := alpha.Counter{ - Name: "sessions", - Count: 21, - Capacity: 42, - } - games := alpha.Counter{ - Name: "games", - Count: 12, - Capacity: 24, - } - gamers := alpha.Counter{ - Name: "gamers", - Count: 263, - Capacity: 500, - } - - mock.counters["sessions"] = &alpha.Counter{ - Name: "sessions", - Count: 21, - Capacity: 42, - } - mock.counters["games"] = &alpha.Counter{ - Name: "games", - Count: 12, - Capacity: 24, - } - mock.counters["gamers"] = &alpha.Counter{ - Name: "gamers", - Count: 263, - Capacity: 500, - } - - a := Alpha{ - client: mock, - } - - t.Parallel() - - t.Run("Set Counter and Set Capacity", func(t *testing.T) { - count, err := a.GetCounterCount("sessions") - assert.NoError(t, err) - assert.Equal(t, sessions.Count, count) - - capacity, err := a.GetCounterCapacity("sessions") - assert.NoError(t, err) - assert.Equal(t, sessions.Capacity, capacity) - - wantCapacity := int64(25) - err = a.SetCounterCapacity("sessions", wantCapacity) - assert.NoError(t, err) - - capacity, err = a.GetCounterCapacity("sessions") - assert.NoError(t, err) - assert.Equal(t, wantCapacity, capacity) - - wantCount := int64(10) - err = a.SetCounterCount("sessions", wantCount) - assert.NoError(t, err) - - count, err = a.GetCounterCount("sessions") - assert.NoError(t, err) - assert.Equal(t, wantCount, count) - }) - - t.Run("Get and Set Non-Defined Counter", func(t *testing.T) { - _, err := a.GetCounterCount("secessions") - assert.Error(t, err) - - _, err = a.GetCounterCapacity("secessions") - assert.Error(t, err) - - err = a.SetCounterCapacity("secessions", int64(100)) - assert.Error(t, err) - - err = a.SetCounterCount("secessions", int64(0)) - assert.Error(t, err) - }) - - // nolint:dupl // testing DecrementCounter and IncrementCounter are not duplicates. - t.Run("Decrement Counter Fails then Success", func(t *testing.T) { - count, err := a.GetCounterCount("games") - assert.NoError(t, err) - assert.Equal(t, games.Count, count) - - err = a.DecrementCounter("games", 21) - assert.Error(t, err) - - count, err = a.GetCounterCount("games") - assert.NoError(t, err) - assert.Equal(t, games.Count, count) - - err = a.DecrementCounter("games", -12) - assert.Error(t, err) - - count, err = a.GetCounterCount("games") - assert.NoError(t, err) - assert.Equal(t, games.Count, count) - - err = a.DecrementCounter("games", 12) - assert.NoError(t, err) - - count, err = a.GetCounterCount("games") - assert.NoError(t, err) - assert.Equal(t, int64(0), count) - }) - - // nolint:dupl // testing DecrementCounter and IncrementCounter are not duplicates. - t.Run("Increment Counter Fails then Success", func(t *testing.T) { - count, err := a.GetCounterCount("gamers") - assert.NoError(t, err) - assert.Equal(t, gamers.Count, count) - - err = a.IncrementCounter("gamers", 250) - assert.Error(t, err) - - count, err = a.GetCounterCount("gamers") - assert.NoError(t, err) - assert.Equal(t, gamers.Count, count) - - err = a.IncrementCounter("gamers", -237) - assert.Error(t, err) - - count, err = a.GetCounterCount("gamers") - assert.NoError(t, err) - assert.Equal(t, gamers.Count, count) - - err = a.IncrementCounter("gamers", 237) - assert.NoError(t, err) - - count, err = a.GetCounterCount("gamers") - assert.NoError(t, err) - assert.Equal(t, int64(500), count) - }) - -} - -func TestAlphaGetAndUpdateList(t *testing.T) { - mock := &alphaMock{} - // Lists must be predefined in the GameServer resource on creation. - mock.lists = make(map[string]*alpha.List) - - foo := alpha.List{ - Name: "foo", - Values: []string{}, - Capacity: 2, - } - bar := alpha.List{ - Name: "bar", - Values: []string{"abc", "def"}, - Capacity: 5, - } - baz := alpha.List{ - Name: "baz", - Values: []string{"123", "456", "789"}, - Capacity: 5, - } - - mock.lists["foo"] = &alpha.List{ - Name: "foo", - Values: []string{}, - Capacity: 2, - } - mock.lists["bar"] = &alpha.List{ - Name: "bar", - Values: []string{"abc", "def"}, - Capacity: 5, - } - mock.lists["baz"] = &alpha.List{ - Name: "baz", - Values: []string{"123", "456", "789"}, - Capacity: 5, - } - - a := Alpha{ - client: mock, - } - - t.Parallel() - - t.Run("Get and Set List Capacity", func(t *testing.T) { - capacity, err := a.GetListCapacity("foo") - assert.NoError(t, err) - assert.Equal(t, foo.Capacity, capacity) - - wantCapacity := int64(5) - err = a.SetListCapacity("foo", wantCapacity) - assert.NoError(t, err) - - capacity, err = a.GetListCapacity("foo") - assert.NoError(t, err) - assert.Equal(t, wantCapacity, capacity) - }) - - t.Run("Get List Length, Get List Values, ListContains, and Append List Value", func(t *testing.T) { - length, err := a.GetListLength("bar") - assert.NoError(t, err) - assert.Equal(t, len(bar.Values), length) - - values, err := a.GetListValues("bar") - assert.NoError(t, err) - assert.Equal(t, bar.Values, values) - - err = a.AppendListValue("bar", "ghi") - assert.NoError(t, err) - - length, err = a.GetListLength("bar") - assert.NoError(t, err) - assert.Equal(t, len(bar.Values)+1, length) - - wantValues := []string{"abc", "def", "ghi"} - values, err = a.GetListValues("bar") - assert.NoError(t, err) - assert.Equal(t, wantValues, values) - - contains, err := a.ListContains("bar", "ghi") - assert.NoError(t, err) - assert.True(t, contains) - }) - - t.Run("Get List Length, Get List Values, ListContains, and Delete List Value", func(t *testing.T) { - length, err := a.GetListLength("baz") - assert.NoError(t, err) - assert.Equal(t, len(baz.Values), length) - - values, err := a.GetListValues("baz") - assert.NoError(t, err) - assert.Equal(t, baz.Values, values) - - err = a.DeleteListValue("baz", "456") - assert.NoError(t, err) - - length, err = a.GetListLength("baz") - assert.NoError(t, err) - assert.Equal(t, len(baz.Values)-1, length) - - wantValues := []string{"123", "789"} - values, err = a.GetListValues("baz") - assert.NoError(t, err) - assert.Equal(t, wantValues, values) - - contains, err := a.ListContains("baz", "456") - assert.NoError(t, err) - assert.False(t, contains) - }) - -} - type alphaMock struct { capacity int64 playerCount int64 playerConnected string playerDisconnected string - counters map[string]*alpha.Counter - lists map[string]*alpha.List } func (a *alphaMock) PlayerConnect(ctx context.Context, id *alpha.PlayerID, opts ...grpc.CallOption) (*alpha.Bool, error) { @@ -366,121 +111,3 @@ func (a *alphaMock) GetPlayerCapacity(ctx context.Context, in *alpha.Empty, opts func (a *alphaMock) GetPlayerCount(ctx context.Context, in *alpha.Empty, opts ...grpc.CallOption) (*alpha.Count, error) { return &alpha.Count{Count: a.playerCount}, nil } - -func (a *alphaMock) GetCounter(ctx context.Context, in *alpha.GetCounterRequest, opts ...grpc.CallOption) (*alpha.Counter, error) { - if counter, ok := a.counters[in.Name]; ok { - return counter, nil - } - return nil, errors.Errorf("counter not found: %s", in.Name) -} - -func (a *alphaMock) UpdateCounter(ctx context.Context, in *alpha.UpdateCounterRequest, opts ...grpc.CallOption) (*alpha.Counter, error) { - counter, err := a.GetCounter(ctx, &alpha.GetCounterRequest{Name: in.CounterUpdateRequest.Name}) - if err != nil { - return nil, err - } - - switch { - case in.CounterUpdateRequest.CountDiff != 0: - count := counter.Count + in.CounterUpdateRequest.CountDiff - if count < 0 || count > counter.Capacity { - return nil, errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", count, counter.Capacity) - } - counter.Count = count - case in.CounterUpdateRequest.Count != nil: - countSet := in.CounterUpdateRequest.Count.GetValue() - if countSet < 0 || countSet > counter.Capacity { - return nil, errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", countSet, counter.Capacity) - } - counter.Count = countSet - case in.CounterUpdateRequest.Capacity != nil: - capacity := in.CounterUpdateRequest.Capacity.GetValue() - if capacity < 0 { - return nil, errors.Errorf("out of range. Capacity must be greater than or equal to 0. Found Capacity: %d", capacity) - } - counter.Capacity = capacity - default: - return nil, errors.Errorf("invalid argument. Malformed CounterUpdateRequest: %v", - in.CounterUpdateRequest) - } - - a.counters[in.CounterUpdateRequest.Name] = counter - return a.counters[in.CounterUpdateRequest.Name], nil -} - -// GetList returns the list of alphaMock. Note: unlike the SDK Server, this does not return -// a list with any pending batched changes applied. -func (a *alphaMock) GetList(ctx context.Context, in *alpha.GetListRequest, opts ...grpc.CallOption) (*alpha.List, error) { - if in == nil { - return nil, errors.Errorf("GetListRequest cannot be nil") - } - if list, ok := a.lists[in.Name]; ok { - return list, nil - } - return nil, errors.Errorf("list not found: %s", in.Name) -} - -// Note: unlike the SDK Server, UpdateList does not batch changes and instead updates the list -// directly. -func (a *alphaMock) UpdateList(ctx context.Context, in *alpha.UpdateListRequest, opts ...grpc.CallOption) (*alpha.List, error) { - if in == nil { - return nil, errors.Errorf("UpdateListRequest cannot be nil") - } - list, ok := a.lists[in.List.Name] - if !ok { - return nil, errors.Errorf("list not found: %s", in.List.Name) - } - if in.List.Capacity < 0 || in.List.Capacity > 1000 { - return nil, errors.Errorf("out of range. Capacity must be within range [0,1000]. Found Capacity: %d", in.List.Capacity) - } - list.Capacity = in.List.Capacity - if len(list.Values) > int(list.Capacity) { - list.Values = append([]string{}, list.Values[:list.Capacity]...) - } - a.lists[in.List.Name] = list - return &alpha.List{}, nil -} - -// Note: unlike the SDK Server, AddListValue does not batch changes and instead updates the list -// directly. -func (a *alphaMock) AddListValue(ctx context.Context, in *alpha.AddListValueRequest, opts ...grpc.CallOption) (*alpha.List, error) { - if in == nil { - return nil, errors.Errorf("AddListValueRequest cannot be nil") - } - list, ok := a.lists[in.Name] - if !ok { - return nil, errors.Errorf("list not found: %s", in.Name) - } - if int(list.Capacity) <= len(list.Values) { - return nil, errors.Errorf("out of range. No available capacity. Current Capacity: %d, List Size: %d", list.Capacity, len(list.Values)) - } - for _, val := range list.Values { - if in.Value == val { - return nil, errors.Errorf("already exists. Value: %s already in List: %s", in.Value, in.Name) - } - } - list.Values = append(list.Values, in.Value) - a.lists[in.Name] = list - return &alpha.List{}, nil -} - -// Note: unlike the SDK Server, RemoveListValue does not batch changes and instead updates the list -// directly. -func (a *alphaMock) RemoveListValue(ctx context.Context, in *alpha.RemoveListValueRequest, opts ...grpc.CallOption) (*alpha.List, error) { - if in == nil { - return nil, errors.Errorf("RemoveListValueRequest cannot be nil") - } - list, ok := a.lists[in.Name] - if !ok { - return nil, errors.Errorf("list not found: %s", in.Name) - } - for i, val := range list.Values { - if in.Value != val { - continue - } - list.Values = append(list.Values[:i], list.Values[i+1:]...) - a.lists[in.Name] = list - return &alpha.List{}, nil - } - return nil, errors.Errorf("not found. Value: %s not found in List: %s", in.Value, in.Name) -} diff --git a/sdks/go/beta.go b/sdks/go/beta.go new file mode 100644 index 0000000000..688f61101e --- /dev/null +++ b/sdks/go/beta.go @@ -0,0 +1,211 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdk + +import ( + "context" + + "github.com/pkg/errors" + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/fieldmaskpb" + "google.golang.org/protobuf/types/known/wrapperspb" + + "agones.dev/agones/pkg/sdk/beta" +) + +// Beta is the struct for Beta SDK functionality. +type Beta struct { + client beta.SDKClient +} + +// newBeta creates a new Beta SDK with the passed in connection. +func newBeta(conn *grpc.ClientConn) *Beta { + return &Beta{ + client: beta.NewSDKClient(conn), + } +} + +// GetCounterCount returns the Count for a Counter, given the Counter's key (name). +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) GetCounterCount(key string) (int64, error) { + counter, err := a.client.GetCounter(context.Background(), &beta.GetCounterRequest{Name: key}) + if err != nil { + return -1, errors.Wrapf(err, "could not get Counter %s count", key) + } + return counter.Count, nil +} + +// IncrementCounter increases a counter by the given nonnegative integer amount. +// Will execute the increment operation against the current CRD value. Will max at max(int64). +// Will error if the key was not predefined in the GameServer resource on creation. +// Returns error if the count is at the current capacity (to the latest knowledge of the SDK), +// and no increment will occur. +// +// Note: A potential race condition here is that if count values are set from both the SDK and +// through the K8s API (Allocation or otherwise), since the SDK append operation back to the CRD +// value is batched asynchronous any value incremented past the capacity will be silently truncated. +func (a *Beta) IncrementCounter(key string, amount int64) error { + if amount < 0 { + return errors.Errorf("amount must be a positive int64, found %d", amount) + } + _, err := a.client.UpdateCounter(context.Background(), &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ + Name: key, + CountDiff: amount, + }}) + if err != nil { + return errors.Wrapf(err, "could not increment Counter %s by amount %d", key, amount) + } + return nil +} + +// DecrementCounter decreases the current count by the given nonnegative integer amount. +// The Counter Will not go below 0. Will execute the decrement operation against the current CRD value. +// Will error if the count is at 0 (to the latest knowledge of the SDK), and no decrement will occur. +func (a *Beta) DecrementCounter(key string, amount int64) error { + if amount < 0 { + return errors.Errorf("amount must be a positive int64, found %d", amount) + } + _, err := a.client.UpdateCounter(context.Background(), &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ + Name: key, + CountDiff: amount * -1, + }}) + if err != nil { + return errors.Wrapf(err, "could not decrement Counter %s by amount %d", key, amount) + } + return nil +} + +// SetCounterCount sets a count to the given value. Use with care, as this will overwrite any previous +// invocations’ value. Cannot be greater than Capacity. +func (a *Beta) SetCounterCount(key string, amount int64) error { + _, err := a.client.UpdateCounter(context.Background(), &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ + Name: key, + Count: wrapperspb.Int64(amount), + }}) + if err != nil { + return errors.Wrapf(err, "could not set Counter %s count to amount %d", key, amount) + } + return nil +} + +// GetCounterCapacity returns the Capacity for a Counter, given the Counter's key (name). +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) GetCounterCapacity(key string) (int64, error) { + counter, err := a.client.GetCounter(context.Background(), &beta.GetCounterRequest{Name: key}) + if err != nil { + return -1, errors.Wrapf(err, "could not get Counter %s capacity", key) + } + return counter.Capacity, nil +} + +// SetCounterCapacity sets the capacity for the given Counter. A capacity of 0 is no capacity. +func (a *Beta) SetCounterCapacity(key string, amount int64) error { + _, err := a.client.UpdateCounter(context.Background(), &beta.UpdateCounterRequest{ + CounterUpdateRequest: &beta.CounterUpdateRequest{ + Name: key, + Capacity: wrapperspb.Int64(amount), + }}) + if err != nil { + return errors.Wrapf(err, "could not set Counter %s capacity to amount %d", key, amount) + } + return nil +} + +// GetListCapacity returns the Capacity for a List, given the List's key (name). +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) GetListCapacity(key string) (int64, error) { + list, err := a.client.GetList(context.Background(), &beta.GetListRequest{Name: key}) + if err != nil { + return -1, errors.Wrapf(err, "could not get List %s", key) + } + return list.Capacity, nil +} + +// SetListCapacity sets the capacity for a given list. Capacity must be between 0 and 1000. +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) SetListCapacity(key string, amount int64) error { + _, err := a.client.UpdateList(context.Background(), &beta.UpdateListRequest{ + List: &beta.List{ + Name: key, + Capacity: amount, + }, + UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"capacity"}}, + }) + if err != nil { + return errors.Wrapf(err, "could not set List %s capacity to amount %d", key, amount) + } + return nil +} + +// ListContains returns if a string exists in a List's values list, given the List's key (name) +// and the string value. Search is case-sensitive. +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) ListContains(key, value string) (bool, error) { + list, err := a.client.GetList(context.Background(), &beta.GetListRequest{Name: key}) + if err != nil { + return false, errors.Wrapf(err, "could not get List %s", key) + } + for _, val := range list.Values { + if val == value { + return true, nil + } + } + return false, nil +} + +// GetListLength returns the length of the Values list for a List, given the List's key (name). +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) GetListLength(key string) (int, error) { + list, err := a.client.GetList(context.Background(), &beta.GetListRequest{Name: key}) + if err != nil { + return -1, errors.Wrapf(err, "could not get List %s", key) + } + return len(list.Values), nil +} + +// GetListValues returns the Values for a List, given the List's key (name). +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) GetListValues(key string) ([]string, error) { + list, err := a.client.GetList(context.Background(), &beta.GetListRequest{Name: key}) + if err != nil { + return nil, errors.Wrapf(err, "could not get List %s", key) + } + return list.Values, nil +} + +// AppendListValue appends a string to a List's values list, given the List's key (name) +// and the string value. Will error if the string already exists in the list. +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) AppendListValue(key, value string) error { + _, err := a.client.AddListValue(context.Background(), &beta.AddListValueRequest{Name: key, Value: value}) + if err != nil { + return errors.Wrapf(err, "could not get List %s", key) + } + return nil +} + +// DeleteListValue removes a string from a List's values list, given the List's key (name) +// and the string value. Will error if the string does not exist in the list. +// Will error if the key was not predefined in the GameServer resource on creation. +func (a *Beta) DeleteListValue(key, value string) error { + _, err := a.client.RemoveListValue(context.Background(), &beta.RemoveListValueRequest{Name: key, Value: value}) + if err != nil { + return errors.Wrapf(err, "could not get List %s", key) + } + return nil +} diff --git a/sdks/go/beta_test.go b/sdks/go/beta_test.go new file mode 100644 index 0000000000..5c13a875c7 --- /dev/null +++ b/sdks/go/beta_test.go @@ -0,0 +1,401 @@ +// Copyright 2020 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package sdk + +import ( + "context" + "testing" + + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "google.golang.org/grpc" + + "agones.dev/agones/pkg/sdk/beta" +) + +func TestBetaGetAndUpdateCounter(t *testing.T) { + mock := &betaMock{} + // Counters must be predefined in the GameServer resource on creation. + mock.counters = make(map[string]*beta.Counter) + + sessions := beta.Counter{ + Name: "sessions", + Count: 21, + Capacity: 42, + } + games := beta.Counter{ + Name: "games", + Count: 12, + Capacity: 24, + } + gamers := beta.Counter{ + Name: "gamers", + Count: 263, + Capacity: 500, + } + + mock.counters["sessions"] = &beta.Counter{ + Name: "sessions", + Count: 21, + Capacity: 42, + } + mock.counters["games"] = &beta.Counter{ + Name: "games", + Count: 12, + Capacity: 24, + } + mock.counters["gamers"] = &beta.Counter{ + Name: "gamers", + Count: 263, + Capacity: 500, + } + + a := Beta{ + client: mock, + } + + t.Parallel() + + t.Run("Set Counter and Set Capacity", func(t *testing.T) { + count, err := a.GetCounterCount("sessions") + assert.NoError(t, err) + assert.Equal(t, sessions.Count, count) + + capacity, err := a.GetCounterCapacity("sessions") + assert.NoError(t, err) + assert.Equal(t, sessions.Capacity, capacity) + + wantCapacity := int64(25) + err = a.SetCounterCapacity("sessions", wantCapacity) + assert.NoError(t, err) + + capacity, err = a.GetCounterCapacity("sessions") + assert.NoError(t, err) + assert.Equal(t, wantCapacity, capacity) + + wantCount := int64(10) + err = a.SetCounterCount("sessions", wantCount) + assert.NoError(t, err) + + count, err = a.GetCounterCount("sessions") + assert.NoError(t, err) + assert.Equal(t, wantCount, count) + }) + + t.Run("Get and Set Non-Defined Counter", func(t *testing.T) { + _, err := a.GetCounterCount("secessions") + assert.Error(t, err) + + _, err = a.GetCounterCapacity("secessions") + assert.Error(t, err) + + err = a.SetCounterCapacity("secessions", int64(100)) + assert.Error(t, err) + + err = a.SetCounterCount("secessions", int64(0)) + assert.Error(t, err) + }) + + // nolint:dupl // testing DecrementCounter and IncrementCounter are not duplicates. + t.Run("Decrement Counter Fails then Success", func(t *testing.T) { + count, err := a.GetCounterCount("games") + assert.NoError(t, err) + assert.Equal(t, games.Count, count) + + err = a.DecrementCounter("games", 21) + assert.Error(t, err) + + count, err = a.GetCounterCount("games") + assert.NoError(t, err) + assert.Equal(t, games.Count, count) + + err = a.DecrementCounter("games", -12) + assert.Error(t, err) + + count, err = a.GetCounterCount("games") + assert.NoError(t, err) + assert.Equal(t, games.Count, count) + + err = a.DecrementCounter("games", 12) + assert.NoError(t, err) + + count, err = a.GetCounterCount("games") + assert.NoError(t, err) + assert.Equal(t, int64(0), count) + }) + + // nolint:dupl // testing DecrementCounter and IncrementCounter are not duplicates. + t.Run("Increment Counter Fails then Success", func(t *testing.T) { + count, err := a.GetCounterCount("gamers") + assert.NoError(t, err) + assert.Equal(t, gamers.Count, count) + + err = a.IncrementCounter("gamers", 250) + assert.Error(t, err) + + count, err = a.GetCounterCount("gamers") + assert.NoError(t, err) + assert.Equal(t, gamers.Count, count) + + err = a.IncrementCounter("gamers", -237) + assert.Error(t, err) + + count, err = a.GetCounterCount("gamers") + assert.NoError(t, err) + assert.Equal(t, gamers.Count, count) + + err = a.IncrementCounter("gamers", 237) + assert.NoError(t, err) + + count, err = a.GetCounterCount("gamers") + assert.NoError(t, err) + assert.Equal(t, int64(500), count) + }) + +} + +func TestBetaGetAndUpdateList(t *testing.T) { + mock := &betaMock{} + // Lists must be predefined in the GameServer resource on creation. + mock.lists = make(map[string]*beta.List) + + foo := beta.List{ + Name: "foo", + Values: []string{}, + Capacity: 2, + } + bar := beta.List{ + Name: "bar", + Values: []string{"abc", "def"}, + Capacity: 5, + } + baz := beta.List{ + Name: "baz", + Values: []string{"123", "456", "789"}, + Capacity: 5, + } + + mock.lists["foo"] = &beta.List{ + Name: "foo", + Values: []string{}, + Capacity: 2, + } + mock.lists["bar"] = &beta.List{ + Name: "bar", + Values: []string{"abc", "def"}, + Capacity: 5, + } + mock.lists["baz"] = &beta.List{ + Name: "baz", + Values: []string{"123", "456", "789"}, + Capacity: 5, + } + + a := Beta{ + client: mock, + } + + t.Parallel() + + t.Run("Get and Set List Capacity", func(t *testing.T) { + capacity, err := a.GetListCapacity("foo") + assert.NoError(t, err) + assert.Equal(t, foo.Capacity, capacity) + + wantCapacity := int64(5) + err = a.SetListCapacity("foo", wantCapacity) + assert.NoError(t, err) + + capacity, err = a.GetListCapacity("foo") + assert.NoError(t, err) + assert.Equal(t, wantCapacity, capacity) + }) + + t.Run("Get List Length, Get List Values, ListContains, and Append List Value", func(t *testing.T) { + length, err := a.GetListLength("bar") + assert.NoError(t, err) + assert.Equal(t, len(bar.Values), length) + + values, err := a.GetListValues("bar") + assert.NoError(t, err) + assert.Equal(t, bar.Values, values) + + err = a.AppendListValue("bar", "ghi") + assert.NoError(t, err) + + length, err = a.GetListLength("bar") + assert.NoError(t, err) + assert.Equal(t, len(bar.Values)+1, length) + + wantValues := []string{"abc", "def", "ghi"} + values, err = a.GetListValues("bar") + assert.NoError(t, err) + assert.Equal(t, wantValues, values) + + contains, err := a.ListContains("bar", "ghi") + assert.NoError(t, err) + assert.True(t, contains) + }) + + t.Run("Get List Length, Get List Values, ListContains, and Delete List Value", func(t *testing.T) { + length, err := a.GetListLength("baz") + assert.NoError(t, err) + assert.Equal(t, len(baz.Values), length) + + values, err := a.GetListValues("baz") + assert.NoError(t, err) + assert.Equal(t, baz.Values, values) + + err = a.DeleteListValue("baz", "456") + assert.NoError(t, err) + + length, err = a.GetListLength("baz") + assert.NoError(t, err) + assert.Equal(t, len(baz.Values)-1, length) + + wantValues := []string{"123", "789"} + values, err = a.GetListValues("baz") + assert.NoError(t, err) + assert.Equal(t, wantValues, values) + + contains, err := a.ListContains("baz", "456") + assert.NoError(t, err) + assert.False(t, contains) + }) + +} + +type betaMock struct { + counters map[string]*beta.Counter + lists map[string]*beta.List +} + +func (a *betaMock) GetCounter(ctx context.Context, in *beta.GetCounterRequest, opts ...grpc.CallOption) (*beta.Counter, error) { + if counter, ok := a.counters[in.Name]; ok { + return counter, nil + } + return nil, errors.Errorf("counter not found: %s", in.Name) +} + +func (a *betaMock) UpdateCounter(ctx context.Context, in *beta.UpdateCounterRequest, opts ...grpc.CallOption) (*beta.Counter, error) { + counter, err := a.GetCounter(ctx, &beta.GetCounterRequest{Name: in.CounterUpdateRequest.Name}) + if err != nil { + return nil, err + } + + switch { + case in.CounterUpdateRequest.CountDiff != 0: + count := counter.Count + in.CounterUpdateRequest.CountDiff + if count < 0 || count > counter.Capacity { + return nil, errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", count, counter.Capacity) + } + counter.Count = count + case in.CounterUpdateRequest.Count != nil: + countSet := in.CounterUpdateRequest.Count.GetValue() + if countSet < 0 || countSet > counter.Capacity { + return nil, errors.Errorf("out of range. Count must be within range [0,Capacity]. Found Count: %d, Capacity: %d", countSet, counter.Capacity) + } + counter.Count = countSet + case in.CounterUpdateRequest.Capacity != nil: + capacity := in.CounterUpdateRequest.Capacity.GetValue() + if capacity < 0 { + return nil, errors.Errorf("out of range. Capacity must be greater than or equal to 0. Found Capacity: %d", capacity) + } + counter.Capacity = capacity + default: + return nil, errors.Errorf("invalid argument. Malformed CounterUpdateRequest: %v", + in.CounterUpdateRequest) + } + + a.counters[in.CounterUpdateRequest.Name] = counter + return a.counters[in.CounterUpdateRequest.Name], nil +} + +// GetList returns the list of betaMock. Note: unlike the SDK Server, this does not return +// a list with any pending batched changes applied. +func (a *betaMock) GetList(ctx context.Context, in *beta.GetListRequest, opts ...grpc.CallOption) (*beta.List, error) { + if in == nil { + return nil, errors.Errorf("GetListRequest cannot be nil") + } + if list, ok := a.lists[in.Name]; ok { + return list, nil + } + return nil, errors.Errorf("list not found: %s", in.Name) +} + +// Note: unlike the SDK Server, UpdateList does not batch changes and instead updates the list +// directly. +func (a *betaMock) UpdateList(ctx context.Context, in *beta.UpdateListRequest, opts ...grpc.CallOption) (*beta.List, error) { + if in == nil { + return nil, errors.Errorf("UpdateListRequest cannot be nil") + } + list, ok := a.lists[in.List.Name] + if !ok { + return nil, errors.Errorf("list not found: %s", in.List.Name) + } + if in.List.Capacity < 0 || in.List.Capacity > 1000 { + return nil, errors.Errorf("out of range. Capacity must be within range [0,1000]. Found Capacity: %d", in.List.Capacity) + } + list.Capacity = in.List.Capacity + if len(list.Values) > int(list.Capacity) { + list.Values = append([]string{}, list.Values[:list.Capacity]...) + } + a.lists[in.List.Name] = list + return &beta.List{}, nil +} + +// Note: unlike the SDK Server, AddListValue does not batch changes and instead updates the list +// directly. +func (a *betaMock) AddListValue(ctx context.Context, in *beta.AddListValueRequest, opts ...grpc.CallOption) (*beta.List, error) { + if in == nil { + return nil, errors.Errorf("AddListValueRequest cannot be nil") + } + list, ok := a.lists[in.Name] + if !ok { + return nil, errors.Errorf("list not found: %s", in.Name) + } + if int(list.Capacity) <= len(list.Values) { + return nil, errors.Errorf("out of range. No available capacity. Current Capacity: %d, List Size: %d", list.Capacity, len(list.Values)) + } + for _, val := range list.Values { + if in.Value == val { + return nil, errors.Errorf("already exists. Value: %s already in List: %s", in.Value, in.Name) + } + } + list.Values = append(list.Values, in.Value) + a.lists[in.Name] = list + return &beta.List{}, nil +} + +// Note: unlike the SDK Server, RemoveListValue does not batch changes and instead updates the list +// directly. +func (a *betaMock) RemoveListValue(ctx context.Context, in *beta.RemoveListValueRequest, opts ...grpc.CallOption) (*beta.List, error) { + if in == nil { + return nil, errors.Errorf("RemoveListValueRequest cannot be nil") + } + list, ok := a.lists[in.Name] + if !ok { + return nil, errors.Errorf("list not found: %s", in.Name) + } + for i, val := range list.Values { + if in.Value != val { + continue + } + list.Values = append(list.Values[:i], list.Values[i+1:]...) + a.lists[in.Name] = list + return &beta.List{}, nil + } + return nil, errors.Errorf("not found. Value: %s not found in List: %s", in.Value, in.Name) +} diff --git a/sdks/go/sdk.go b/sdks/go/sdk.go index b6a1414d43..8484a9ea71 100644 --- a/sdks/go/sdk.go +++ b/sdks/go/sdk.go @@ -40,6 +40,7 @@ type SDK struct { ctx context.Context health sdk.SDK_HealthClient alpha *Alpha + beta *Beta } // ErrorLog is a function to log the error. @@ -78,6 +79,7 @@ func NewSDK() (*SDK, error) { s.client = sdk.NewSDKClient(conn) s.health, err = s.client.Health(s.ctx) s.alpha = newAlpha(conn) + s.beta = newBeta(conn) return s, errors.Wrap(err, "could not set up health check") } @@ -86,6 +88,11 @@ func (s *SDK) Alpha() *Alpha { return s.alpha } +// Beta returns the Beta SDK. +func (s *SDK) Beta() *Beta { + return s.beta +} + // Ready marks the Game Server as ready to receive connections. func (s *SDK) Ready() error { _, err := s.client.Ready(s.ctx, &sdk.Empty{}) diff --git a/sdks/nodejs/lib/alpha/alpha_grpc_pb.js b/sdks/nodejs/lib/alpha/alpha_grpc_pb.js index 7958d8a95f..b798c82be1 100644 --- a/sdks/nodejs/lib/alpha/alpha_grpc_pb.js +++ b/sdks/nodejs/lib/alpha/alpha_grpc_pb.js @@ -33,25 +33,8 @@ 'use strict'; var alpha_pb = require('./alpha_pb.js'); var google_api_annotations_pb = require('./google/api/annotations_pb.js'); -var google_api_client_pb = require('./google/api/client_pb.js'); -var google_api_field_behavior_pb = require('./google/api/field_behavior_pb.js'); -var google_api_resource_pb = require('./google/api/resource_pb.js'); -var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); -var google_protobuf_field_mask_pb = require('google-protobuf/google/protobuf/field_mask_pb.js'); -var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js'); var protoc$gen$openapiv2_options_annotations_pb = require('./protoc-gen-openapiv2/options/annotations_pb.js'); -function serialize_agones_dev_sdk_alpha_AddListValueRequest(arg) { - if (!(arg instanceof alpha_pb.AddListValueRequest)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.AddListValueRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_AddListValueRequest(buffer_arg) { - return alpha_pb.AddListValueRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - function serialize_agones_dev_sdk_alpha_Bool(arg) { if (!(arg instanceof alpha_pb.Bool)) { throw new Error('Expected argument of type agones.dev.sdk.alpha.Bool'); @@ -74,17 +57,6 @@ function deserialize_agones_dev_sdk_alpha_Count(buffer_arg) { return alpha_pb.Count.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_agones_dev_sdk_alpha_Counter(arg) { - if (!(arg instanceof alpha_pb.Counter)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.Counter'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_Counter(buffer_arg) { - return alpha_pb.Counter.deserializeBinary(new Uint8Array(buffer_arg)); -} - function serialize_agones_dev_sdk_alpha_Empty(arg) { if (!(arg instanceof alpha_pb.Empty)) { throw new Error('Expected argument of type agones.dev.sdk.alpha.Empty'); @@ -96,39 +68,6 @@ function deserialize_agones_dev_sdk_alpha_Empty(buffer_arg) { return alpha_pb.Empty.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_agones_dev_sdk_alpha_GetCounterRequest(arg) { - if (!(arg instanceof alpha_pb.GetCounterRequest)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.GetCounterRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_GetCounterRequest(buffer_arg) { - return alpha_pb.GetCounterRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_GetListRequest(arg) { - if (!(arg instanceof alpha_pb.GetListRequest)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.GetListRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_GetListRequest(buffer_arg) { - return alpha_pb.GetListRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_List(arg) { - if (!(arg instanceof alpha_pb.List)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.List'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_List(buffer_arg) { - return alpha_pb.List.deserializeBinary(new Uint8Array(buffer_arg)); -} - function serialize_agones_dev_sdk_alpha_PlayerID(arg) { if (!(arg instanceof alpha_pb.PlayerID)) { throw new Error('Expected argument of type agones.dev.sdk.alpha.PlayerID'); @@ -151,39 +90,6 @@ function deserialize_agones_dev_sdk_alpha_PlayerIDList(buffer_arg) { return alpha_pb.PlayerIDList.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_agones_dev_sdk_alpha_RemoveListValueRequest(arg) { - if (!(arg instanceof alpha_pb.RemoveListValueRequest)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.RemoveListValueRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_RemoveListValueRequest(buffer_arg) { - return alpha_pb.RemoveListValueRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_UpdateCounterRequest(arg) { - if (!(arg instanceof alpha_pb.UpdateCounterRequest)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.UpdateCounterRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_UpdateCounterRequest(buffer_arg) { - return alpha_pb.UpdateCounterRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_agones_dev_sdk_alpha_UpdateListRequest(arg) { - if (!(arg instanceof alpha_pb.UpdateListRequest)) { - throw new Error('Expected argument of type agones.dev.sdk.alpha.UpdateListRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_agones_dev_sdk_alpha_UpdateListRequest(buffer_arg) { - return alpha_pb.UpdateListRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - // SDK service to be used in the GameServer SDK to the Pod Sidecar. var SDKService = exports['agones.dev.sdk.alpha.SDK'] = { @@ -310,86 +216,5 @@ getConnectedPlayers: { responseSerialize: serialize_agones_dev_sdk_alpha_PlayerIDList, responseDeserialize: deserialize_agones_dev_sdk_alpha_PlayerIDList, }, - // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. -getCounter: { - path: '/agones.dev.sdk.alpha.SDK/GetCounter', - requestStream: false, - responseStream: false, - requestType: alpha_pb.GetCounterRequest, - responseType: alpha_pb.Counter, - requestSerialize: serialize_agones_dev_sdk_alpha_GetCounterRequest, - requestDeserialize: deserialize_agones_dev_sdk_alpha_GetCounterRequest, - responseSerialize: serialize_agones_dev_sdk_alpha_Counter, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Counter, - }, - // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). -// Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. -updateCounter: { - path: '/agones.dev.sdk.alpha.SDK/UpdateCounter', - requestStream: false, - responseStream: false, - requestType: alpha_pb.UpdateCounterRequest, - responseType: alpha_pb.Counter, - requestSerialize: serialize_agones_dev_sdk_alpha_UpdateCounterRequest, - requestDeserialize: deserialize_agones_dev_sdk_alpha_UpdateCounterRequest, - responseSerialize: serialize_agones_dev_sdk_alpha_Counter, - responseDeserialize: deserialize_agones_dev_sdk_alpha_Counter, - }, - // Gets a List. Returns NOT_FOUND if the List does not exist. -getList: { - path: '/agones.dev.sdk.alpha.SDK/GetList', - requestStream: false, - responseStream: false, - requestType: alpha_pb.GetListRequest, - responseType: alpha_pb.List, - requestSerialize: serialize_agones_dev_sdk_alpha_GetListRequest, - requestDeserialize: deserialize_agones_dev_sdk_alpha_GetListRequest, - responseSerialize: serialize_agones_dev_sdk_alpha_List, - responseDeserialize: deserialize_agones_dev_sdk_alpha_List, - }, - // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). -// **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** -// Use AddListValue() or RemoveListValue() for modifying the List.Values field. -// Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. -// If a field mask path(s) is specified, but the value is not set in the request List object, -// then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). -updateList: { - path: '/agones.dev.sdk.alpha.SDK/UpdateList', - requestStream: false, - responseStream: false, - requestType: alpha_pb.UpdateListRequest, - responseType: alpha_pb.List, - requestSerialize: serialize_agones_dev_sdk_alpha_UpdateListRequest, - requestDeserialize: deserialize_agones_dev_sdk_alpha_UpdateListRequest, - responseSerialize: serialize_agones_dev_sdk_alpha_List, - responseDeserialize: deserialize_agones_dev_sdk_alpha_List, - }, - // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. -// Returns ALREADY_EXISTS if the value is already in the List. -// Returns OUT_OF_RANGE if the List is already at Capacity. -addListValue: { - path: '/agones.dev.sdk.alpha.SDK/AddListValue', - requestStream: false, - responseStream: false, - requestType: alpha_pb.AddListValueRequest, - responseType: alpha_pb.List, - requestSerialize: serialize_agones_dev_sdk_alpha_AddListValueRequest, - requestDeserialize: deserialize_agones_dev_sdk_alpha_AddListValueRequest, - responseSerialize: serialize_agones_dev_sdk_alpha_List, - responseDeserialize: deserialize_agones_dev_sdk_alpha_List, - }, - // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. -// Returns NOT_FOUND if the value is not in the List. -removeListValue: { - path: '/agones.dev.sdk.alpha.SDK/RemoveListValue', - requestStream: false, - responseStream: false, - requestType: alpha_pb.RemoveListValueRequest, - responseType: alpha_pb.List, - requestSerialize: serialize_agones_dev_sdk_alpha_RemoveListValueRequest, - requestDeserialize: deserialize_agones_dev_sdk_alpha_RemoveListValueRequest, - responseSerialize: serialize_agones_dev_sdk_alpha_List, - responseDeserialize: deserialize_agones_dev_sdk_alpha_List, - }, }; diff --git a/sdks/nodejs/lib/alpha/alpha_pb.js b/sdks/nodejs/lib/alpha/alpha_pb.js index 9a1989dd80..47dceaf890 100644 --- a/sdks/nodejs/lib/alpha/alpha_pb.js +++ b/sdks/nodejs/lib/alpha/alpha_pb.js @@ -32,34 +32,13 @@ var global = Function('return this')(); var google_api_annotations_pb = require('./google/api/annotations_pb.js'); goog.object.extend(proto, google_api_annotations_pb); -var google_api_client_pb = require('./google/api/client_pb.js'); -goog.object.extend(proto, google_api_client_pb); -var google_api_field_behavior_pb = require('./google/api/field_behavior_pb.js'); -goog.object.extend(proto, google_api_field_behavior_pb); -var google_api_resource_pb = require('./google/api/resource_pb.js'); -goog.object.extend(proto, google_api_resource_pb); -var google_protobuf_empty_pb = require('google-protobuf/google/protobuf/empty_pb.js'); -goog.object.extend(proto, google_protobuf_empty_pb); -var google_protobuf_field_mask_pb = require('google-protobuf/google/protobuf/field_mask_pb.js'); -goog.object.extend(proto, google_protobuf_field_mask_pb); -var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js'); -goog.object.extend(proto, google_protobuf_wrappers_pb); var protoc$gen$openapiv2_options_annotations_pb = require('./protoc-gen-openapiv2/options/annotations_pb.js'); goog.object.extend(proto, protoc$gen$openapiv2_options_annotations_pb); -goog.exportSymbol('proto.agones.dev.sdk.alpha.AddListValueRequest', null, global); goog.exportSymbol('proto.agones.dev.sdk.alpha.Bool', null, global); goog.exportSymbol('proto.agones.dev.sdk.alpha.Count', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.Counter', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.CounterUpdateRequest', null, global); goog.exportSymbol('proto.agones.dev.sdk.alpha.Empty', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.GetCounterRequest', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.GetListRequest', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.List', null, global); goog.exportSymbol('proto.agones.dev.sdk.alpha.PlayerID', null, global); goog.exportSymbol('proto.agones.dev.sdk.alpha.PlayerIDList', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.RemoveListValueRequest', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.UpdateCounterRequest', null, global); -goog.exportSymbol('proto.agones.dev.sdk.alpha.UpdateListRequest', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -165,195 +144,6 @@ if (goog.DEBUG && !COMPILED) { */ proto.agones.dev.sdk.alpha.PlayerIDList.displayName = 'proto.agones.dev.sdk.alpha.PlayerIDList'; } -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.Counter = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.Counter, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.Counter.displayName = 'proto.agones.dev.sdk.alpha.Counter'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.CounterUpdateRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.CounterUpdateRequest.displayName = 'proto.agones.dev.sdk.alpha.CounterUpdateRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.GetCounterRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.GetCounterRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.GetCounterRequest.displayName = 'proto.agones.dev.sdk.alpha.GetCounterRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.UpdateCounterRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.UpdateCounterRequest.displayName = 'proto.agones.dev.sdk.alpha.UpdateCounterRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.List = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.agones.dev.sdk.alpha.List.repeatedFields_, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.List, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.List.displayName = 'proto.agones.dev.sdk.alpha.List'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.GetListRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.GetListRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.GetListRequest.displayName = 'proto.agones.dev.sdk.alpha.GetListRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.UpdateListRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.UpdateListRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.UpdateListRequest.displayName = 'proto.agones.dev.sdk.alpha.UpdateListRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.AddListValueRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.AddListValueRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.AddListValueRequest.displayName = 'proto.agones.dev.sdk.alpha.AddListValueRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.agones.dev.sdk.alpha.RemoveListValueRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.agones.dev.sdk.alpha.RemoveListValueRequest.displayName = 'proto.agones.dev.sdk.alpha.RemoveListValueRequest'; -} @@ -1001,1605 +791,4 @@ proto.agones.dev.sdk.alpha.PlayerIDList.prototype.clearListList = function() { }; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.Counter.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.Counter.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.Counter} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Counter.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - count: jspb.Message.getFieldWithDefault(msg, 2, 0), - capacity: jspb.Message.getFieldWithDefault(msg, 3, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.Counter} - */ -proto.agones.dev.sdk.alpha.Counter.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.Counter; - return proto.agones.dev.sdk.alpha.Counter.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.Counter} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.Counter} - */ -proto.agones.dev.sdk.alpha.Counter.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCount(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCapacity(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.Counter.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.Counter.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.Counter} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.Counter.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getCount(); - if (f !== 0) { - writer.writeInt64( - 2, - f - ); - } - f = message.getCapacity(); - if (f !== 0) { - writer.writeInt64( - 3, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.Counter.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.Counter} returns this - */ -proto.agones.dev.sdk.alpha.Counter.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional int64 count = 2; - * @return {number} - */ -proto.agones.dev.sdk.alpha.Counter.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.alpha.Counter} returns this - */ -proto.agones.dev.sdk.alpha.Counter.prototype.setCount = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * optional int64 capacity = 3; - * @return {number} - */ -proto.agones.dev.sdk.alpha.Counter.prototype.getCapacity = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.alpha.Counter} returns this - */ -proto.agones.dev.sdk.alpha.Counter.prototype.setCapacity = function(value) { - return jspb.Message.setProto3IntField(this, 3, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.CounterUpdateRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - count: (f = msg.getCount()) && google_protobuf_wrappers_pb.Int64Value.toObject(includeInstance, f), - capacity: (f = msg.getCapacity()) && google_protobuf_wrappers_pb.Int64Value.toObject(includeInstance, f), - countdiff: jspb.Message.getFieldWithDefault(msg, 4, 0) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.CounterUpdateRequest; - return proto.agones.dev.sdk.alpha.CounterUpdateRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 2: - var value = new google_protobuf_wrappers_pb.Int64Value; - reader.readMessage(value,google_protobuf_wrappers_pb.Int64Value.deserializeBinaryFromReader); - msg.setCount(value); - break; - case 3: - var value = new google_protobuf_wrappers_pb.Int64Value; - reader.readMessage(value,google_protobuf_wrappers_pb.Int64Value.deserializeBinaryFromReader); - msg.setCapacity(value); - break; - case 4: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCountdiff(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.CounterUpdateRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getCount(); - if (f != null) { - writer.writeMessage( - 2, - f, - google_protobuf_wrappers_pb.Int64Value.serializeBinaryToWriter - ); - } - f = message.getCapacity(); - if (f != null) { - writer.writeMessage( - 3, - f, - google_protobuf_wrappers_pb.Int64Value.serializeBinaryToWriter - ); - } - f = message.getCountdiff(); - if (f !== 0) { - writer.writeInt64( - 4, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} returns this - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional google.protobuf.Int64Value count = 2; - * @return {?proto.google.protobuf.Int64Value} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.getCount = function() { - return /** @type{?proto.google.protobuf.Int64Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.Int64Value, 2)); -}; - - -/** - * @param {?proto.google.protobuf.Int64Value|undefined} value - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} returns this -*/ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.setCount = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} returns this - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.clearCount = function() { - return this.setCount(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.hasCount = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * optional google.protobuf.Int64Value capacity = 3; - * @return {?proto.google.protobuf.Int64Value} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.getCapacity = function() { - return /** @type{?proto.google.protobuf.Int64Value} */ ( - jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.Int64Value, 3)); -}; - - -/** - * @param {?proto.google.protobuf.Int64Value|undefined} value - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} returns this -*/ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.setCapacity = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} returns this - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.clearCapacity = function() { - return this.setCapacity(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.hasCapacity = function() { - return jspb.Message.getField(this, 3) != null; -}; - - -/** - * optional int64 countDiff = 4; - * @return {number} - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.getCountdiff = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.alpha.CounterUpdateRequest} returns this - */ -proto.agones.dev.sdk.alpha.CounterUpdateRequest.prototype.setCountdiff = function(value) { - return jspb.Message.setProto3IntField(this, 4, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.GetCounterRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.GetCounterRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.GetCounterRequest} - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.GetCounterRequest; - return proto.agones.dev.sdk.alpha.GetCounterRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.GetCounterRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.GetCounterRequest} - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.GetCounterRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.GetCounterRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.GetCounterRequest} returns this - */ -proto.agones.dev.sdk.alpha.GetCounterRequest.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.UpdateCounterRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.toObject = function(includeInstance, msg) { - var f, obj = { - counterupdaterequest: (f = msg.getCounterupdaterequest()) && proto.agones.dev.sdk.alpha.CounterUpdateRequest.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.UpdateCounterRequest; - return proto.agones.dev.sdk.alpha.UpdateCounterRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.agones.dev.sdk.alpha.CounterUpdateRequest; - reader.readMessage(value,proto.agones.dev.sdk.alpha.CounterUpdateRequest.deserializeBinaryFromReader); - msg.setCounterupdaterequest(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.UpdateCounterRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getCounterupdaterequest(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.agones.dev.sdk.alpha.CounterUpdateRequest.serializeBinaryToWriter - ); - } -}; - - -/** - * optional CounterUpdateRequest counterUpdateRequest = 1; - * @return {?proto.agones.dev.sdk.alpha.CounterUpdateRequest} - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.prototype.getCounterupdaterequest = function() { - return /** @type{?proto.agones.dev.sdk.alpha.CounterUpdateRequest} */ ( - jspb.Message.getWrapperField(this, proto.agones.dev.sdk.alpha.CounterUpdateRequest, 1)); -}; - - -/** - * @param {?proto.agones.dev.sdk.alpha.CounterUpdateRequest|undefined} value - * @return {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} returns this -*/ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.prototype.setCounterupdaterequest = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.agones.dev.sdk.alpha.UpdateCounterRequest} returns this - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.prototype.clearCounterupdaterequest = function() { - return this.setCounterupdaterequest(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.agones.dev.sdk.alpha.UpdateCounterRequest.prototype.hasCounterupdaterequest = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -proto.agones.dev.sdk.alpha.List.repeatedFields_ = [3]; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.List.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.List.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.List} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.List.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - capacity: jspb.Message.getFieldWithDefault(msg, 2, 0), - valuesList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.List} - */ -proto.agones.dev.sdk.alpha.List.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.List; - return proto.agones.dev.sdk.alpha.List.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.List} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.List} - */ -proto.agones.dev.sdk.alpha.List.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 2: - var value = /** @type {number} */ (reader.readInt64()); - msg.setCapacity(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addValues(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.List.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.List.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.List} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.List.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getCapacity(); - if (f !== 0) { - writer.writeInt64( - 2, - f - ); - } - f = message.getValuesList(); - if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.List.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.List} returns this - */ -proto.agones.dev.sdk.alpha.List.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional int64 capacity = 2; - * @return {number} - */ -proto.agones.dev.sdk.alpha.List.prototype.getCapacity = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.agones.dev.sdk.alpha.List} returns this - */ -proto.agones.dev.sdk.alpha.List.prototype.setCapacity = function(value) { - return jspb.Message.setProto3IntField(this, 2, value); -}; - - -/** - * repeated string values = 3; - * @return {!Array} - */ -proto.agones.dev.sdk.alpha.List.prototype.getValuesList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); -}; - - -/** - * @param {!Array} value - * @return {!proto.agones.dev.sdk.alpha.List} returns this - */ -proto.agones.dev.sdk.alpha.List.prototype.setValuesList = function(value) { - return jspb.Message.setField(this, 3, value || []); -}; - - -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.agones.dev.sdk.alpha.List} returns this - */ -proto.agones.dev.sdk.alpha.List.prototype.addValues = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; - - -/** - * Clears the list making it empty but non-null. - * @return {!proto.agones.dev.sdk.alpha.List} returns this - */ -proto.agones.dev.sdk.alpha.List.prototype.clearValuesList = function() { - return this.setValuesList([]); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.GetListRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.GetListRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.GetListRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.GetListRequest.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.GetListRequest} - */ -proto.agones.dev.sdk.alpha.GetListRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.GetListRequest; - return proto.agones.dev.sdk.alpha.GetListRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.GetListRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.GetListRequest} - */ -proto.agones.dev.sdk.alpha.GetListRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.GetListRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.GetListRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.GetListRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.GetListRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.GetListRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.GetListRequest} returns this - */ -proto.agones.dev.sdk.alpha.GetListRequest.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.UpdateListRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.UpdateListRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.toObject = function(includeInstance, msg) { - var f, obj = { - list: (f = msg.getList()) && proto.agones.dev.sdk.alpha.List.toObject(includeInstance, f), - updateMask: (f = msg.getUpdateMask()) && google_protobuf_field_mask_pb.FieldMask.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.UpdateListRequest} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.UpdateListRequest; - return proto.agones.dev.sdk.alpha.UpdateListRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.UpdateListRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.UpdateListRequest} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new proto.agones.dev.sdk.alpha.List; - reader.readMessage(value,proto.agones.dev.sdk.alpha.List.deserializeBinaryFromReader); - msg.setList(value); - break; - case 2: - var value = new google_protobuf_field_mask_pb.FieldMask; - reader.readMessage(value,google_protobuf_field_mask_pb.FieldMask.deserializeBinaryFromReader); - msg.setUpdateMask(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.UpdateListRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.UpdateListRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getList(); - if (f != null) { - writer.writeMessage( - 1, - f, - proto.agones.dev.sdk.alpha.List.serializeBinaryToWriter - ); - } - f = message.getUpdateMask(); - if (f != null) { - writer.writeMessage( - 2, - f, - google_protobuf_field_mask_pb.FieldMask.serializeBinaryToWriter - ); - } -}; - - -/** - * optional List list = 1; - * @return {?proto.agones.dev.sdk.alpha.List} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.getList = function() { - return /** @type{?proto.agones.dev.sdk.alpha.List} */ ( - jspb.Message.getWrapperField(this, proto.agones.dev.sdk.alpha.List, 1)); -}; - - -/** - * @param {?proto.agones.dev.sdk.alpha.List|undefined} value - * @return {!proto.agones.dev.sdk.alpha.UpdateListRequest} returns this -*/ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.setList = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.agones.dev.sdk.alpha.UpdateListRequest} returns this - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.clearList = function() { - return this.setList(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.hasList = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional google.protobuf.FieldMask update_mask = 2; - * @return {?proto.google.protobuf.FieldMask} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.getUpdateMask = function() { - return /** @type{?proto.google.protobuf.FieldMask} */ ( - jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 2)); -}; - - -/** - * @param {?proto.google.protobuf.FieldMask|undefined} value - * @return {!proto.agones.dev.sdk.alpha.UpdateListRequest} returns this -*/ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.setUpdateMask = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.agones.dev.sdk.alpha.UpdateListRequest} returns this - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.clearUpdateMask = function() { - return this.setUpdateMask(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.agones.dev.sdk.alpha.UpdateListRequest.prototype.hasUpdateMask = function() { - return jspb.Message.getField(this, 2) != null; -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.AddListValueRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.AddListValueRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - value: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.AddListValueRequest} - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.AddListValueRequest; - return proto.agones.dev.sdk.alpha.AddListValueRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.AddListValueRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.AddListValueRequest} - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.AddListValueRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.AddListValueRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getValue(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.AddListValueRequest} returns this - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string value = 2; - * @return {string} - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.AddListValueRequest} returns this - */ -proto.agones.dev.sdk.alpha.AddListValueRequest.prototype.setValue = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.prototype.toObject = function(opt_includeInstance) { - return proto.agones.dev.sdk.alpha.RemoveListValueRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.toObject = function(includeInstance, msg) { - var f, obj = { - name: jspb.Message.getFieldWithDefault(msg, 1, ""), - value: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.agones.dev.sdk.alpha.RemoveListValueRequest; - return proto.agones.dev.sdk.alpha.RemoveListValueRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setValue(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.agones.dev.sdk.alpha.RemoveListValueRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getName(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getValue(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } -}; - - -/** - * optional string name = 1; - * @return {string} - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} returns this - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.prototype.setName = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string value = 2; - * @return {string} - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.agones.dev.sdk.alpha.RemoveListValueRequest} returns this - */ -proto.agones.dev.sdk.alpha.RemoveListValueRequest.prototype.setValue = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - goog.object.extend(exports, proto.agones.dev.sdk.alpha); diff --git a/sdks/rust/proto/sdk/alpha/alpha.proto b/sdks/rust/proto/sdk/alpha/alpha.proto index 8e92cf7006..1db8bc74d9 100644 --- a/sdks/rust/proto/sdk/alpha/alpha.proto +++ b/sdks/rust/proto/sdk/alpha/alpha.proto @@ -18,12 +18,6 @@ package agones.dev.sdk.alpha; option go_package = "./alpha"; import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { @@ -128,65 +122,6 @@ service SDK { get: "/alpha/player/connected" }; } - - // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. - rpc GetCounter(GetCounterRequest) returns (Counter) { - option (google.api.http) = { - get: "/v1alpha1/counters/{name}" - }; - option (google.api.method_signature) = "name"; - } - - // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). - // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. - rpc UpdateCounter(UpdateCounterRequest) returns (Counter) { - option (google.api.http) = { - patch: "/v1alpha1/counters/{counterUpdateRequest.name}" - body: "counterUpdateRequest" - }; - option (google.api.method_signature) = "counterUpdateRequest"; - } - - // Gets a List. Returns NOT_FOUND if the List does not exist. - rpc GetList(GetListRequest) returns (List) { - option (google.api.http) = { - get: "/v1alpha1/lists/{name}" - }; - option (google.api.method_signature) = "name"; - } - - // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). - // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** - // Use AddListValue() or RemoveListValue() for modifying the List.Values field. - // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. - // If a field mask path(s) is specified, but the value is not set in the request List object, - // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). - rpc UpdateList(UpdateListRequest) returns (List) { - option (google.api.http) = { - patch: "/v1alpha1/lists/{list.name}" - body: "list" - }; - option (google.api.method_signature) = "list,update_mask"; - } - - // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns ALREADY_EXISTS if the value is already in the List. - // Returns OUT_OF_RANGE if the List is already at Capacity. - rpc AddListValue(AddListValueRequest) returns (List) { - option (google.api.http) = { - post: "/v1alpha1/lists/{name}:addValue" - body: "*" - }; - } - - // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. - // Returns NOT_FOUND if the value is not in the List. - rpc RemoveListValue(RemoveListValueRequest) returns (List) { - option (google.api.http) = { - post: "/v1alpha1/lists/{name}:removeValue" - body: "*" - }; - } } // I am Empty @@ -212,111 +147,3 @@ message PlayerID { message PlayerIDList { repeated string list = 1; } - -// A representation of a Counter. -message Counter { - option (google.api.resource) = { - type: "agones.dev/Counter" - pattern: "counters/{counter}" - }; - // The name of the Counter - string name = 1; - // The current count of the Counter - int64 count = 2; - // The maximum capacity of the Counter - int64 capacity = 3; -} - -// A representation of a Counter Update Request. -message CounterUpdateRequest { - option (google.api.resource) = { - type: "agones.dev/CounterUpdateRequest" - pattern: "counterUpdateRequests/{counterUpdateRequest}" - }; - // The name of the Counter to update - string name = 1; - // The value to set the Counter Count - google.protobuf.Int64Value count = 2; - // The value to set the Counter Capacity - google.protobuf.Int64Value capacity = 3; - // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement - // (negative), 0 if a CountSet or CapacitySet request - int64 countDiff = 4; -} - -message GetCounterRequest { - // The name of the Counter to get - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/Counter" - }]; -} - -message UpdateCounterRequest { - // The requested update to make to the Counter - CounterUpdateRequest counterUpdateRequest = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/CounterUpdateRequest" - }]; -} - -// A representation of a List. -message List { - option (google.api.resource) = { - type: "agones.dev/List" - pattern: "lists/{list}" - }; - // The name of the List - string name = 1; - // The maximum capacity of the List - int64 capacity = 2; - // The array of items in the List ["v1", "v2", …] - repeated string values = 3; -} - -message GetListRequest { - // The name of the List to get - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; -} - -message UpdateListRequest { - // The List to update - List list = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - // Required. Mask (list) of fields to update. - // Fields are specified relative to the List - // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message AddListValueRequest { - // The name of the List to add a value to. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message RemoveListValueRequest { - // The name of the List to remove a value from. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "agones.dev/List" - }]; - - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/sdks/rust/proto/sdk/beta/beta.proto b/sdks/rust/proto/sdk/beta/beta.proto index d0ef73fc57..0542cb64a2 100644 --- a/sdks/rust/proto/sdk/beta/beta.proto +++ b/sdks/rust/proto/sdk/beta/beta.proto @@ -18,6 +18,12 @@ package agones.dev.sdk.beta; option go_package = "./beta"; import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/wrappers.proto"; import "protoc-gen-openapiv2/options/annotations.proto"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { @@ -31,4 +37,175 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { }; // SDK service to be used in the GameServer SDK to the Pod Sidecar -service SDK {} \ No newline at end of file +service SDK { + // Gets a Counter. Returns NOT_FOUND if the Counter does not exist. + rpc GetCounter(GetCounterRequest) returns (Counter) { + option (google.api.http) = { + get: "/v1beta1/counters/{name}" + }; + option (google.api.method_signature) = "name"; + } + + // UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). + // Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. + rpc UpdateCounter(UpdateCounterRequest) returns (Counter) { + option (google.api.http) = { + patch: "/v1beta1/counters/{counterUpdateRequest.name}" + body: "counterUpdateRequest" + }; + option (google.api.method_signature) = "counterUpdateRequest"; + } + + // Gets a List. Returns NOT_FOUND if the List does not exist. + rpc GetList(GetListRequest) returns (List) { + option (google.api.http) = { + get: "/v1beta1/lists/{name}" + }; + option (google.api.method_signature) = "name"; + } + + // UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). + // **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** + // Use AddListValue() or RemoveListValue() for modifying the List.Values field. + // Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. + // If a field mask path(s) is specified, but the value is not set in the request List object, + // then the default value for the variable will be set (i.e. 0 for "capacity", empty list for "values"). + rpc UpdateList(UpdateListRequest) returns (List) { + option (google.api.http) = { + patch: "/v1beta1/lists/{list.name}" + body: "list" + }; + option (google.api.method_signature) = "list,update_mask"; + } + + // Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns ALREADY_EXISTS if the value is already in the List. + // Returns OUT_OF_RANGE if the List is already at Capacity. + rpc AddListValue(AddListValueRequest) returns (List) { + option (google.api.http) = { + post: "/v1beta1/lists/{name}:addValue" + body: "*" + }; + } + + // Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. + // Returns NOT_FOUND if the value is not in the List. + rpc RemoveListValue(RemoveListValueRequest) returns (List) { + option (google.api.http) = { + post: "/v1beta1/lists/{name}:removeValue" + body: "*" + }; + } +} + +// I am Empty +message Empty { +} + +// A representation of a Counter. +message Counter { + option (google.api.resource) = { + type: "agones.dev/Counter" + pattern: "counters/{counter}" + }; + // The name of the Counter + string name = 1; + // The current count of the Counter + int64 count = 2; + // The maximum capacity of the Counter + int64 capacity = 3; +} + +// A representation of a Counter Update Request. +message CounterUpdateRequest { + option (google.api.resource) = { + type: "agones.dev/CounterUpdateRequest" + pattern: "counterUpdateRequests/{counterUpdateRequest}" + }; + // The name of the Counter to update + string name = 1; + // The value to set the Counter Count + google.protobuf.Int64Value count = 2; + // The value to set the Counter Capacity + google.protobuf.Int64Value capacity = 3; + // countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement + // (negative), 0 if a CountSet or CapacitySet request + int64 countDiff = 4; +} + +message GetCounterRequest { + // The name of the Counter to get + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/Counter" + }]; +} + +message UpdateCounterRequest { + // The requested update to make to the Counter + CounterUpdateRequest counterUpdateRequest = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/CounterUpdateRequest" + }]; +} + +// A representation of a List. +message List { + option (google.api.resource) = { + type: "agones.dev/List" + pattern: "lists/{list}" + }; + // The name of the List + string name = 1; + // The maximum capacity of the List + int64 capacity = 2; + // The array of items in the List ["v1", "v2", …] + repeated string values = 3; +} + +message GetListRequest { + // The name of the List to get + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; +} + +message UpdateListRequest { + // The List to update + List list = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + // Required. Mask (list) of fields to update. + // Fields are specified relative to the List + // (e.g. `capacity`, `values`; *not* `List.capacity` or `List.values`). + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message AddListValueRequest { + // The name of the List to add a value to. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message RemoveListValueRequest { + // The name of the List to remove a value from. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "agones.dev/List" + }]; + + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} \ No newline at end of file diff --git a/sdks/rust/proto/sdk/sdk.proto b/sdks/rust/proto/sdk/sdk.proto index 2c210c3454..6504c64654 100644 --- a/sdks/rust/proto/sdk/sdk.proto +++ b/sdks/rust/proto/sdk/sdk.proto @@ -167,14 +167,14 @@ message GameServer { repeated string ids = 3; } - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] message CounterStatus { int64 count = 1; int64 capacity = 2; } - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] message ListStatus { int64 capacity = 1; @@ -190,11 +190,11 @@ message GameServer { // [FeatureFlag:PlayerTracking] PlayerStatus players = 4; - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] map counters = 5; - // [Stage:Alpha] + // [Stage:Beta] // [FeatureFlag:CountsAndLists] map lists = 6; } diff --git a/sdks/swagger/alpha.swagger.json b/sdks/swagger/alpha.swagger.json index 0b186f641e..6d579f5a96 100644 --- a/sdks/swagger/alpha.swagger.json +++ b/sdks/swagger/alpha.swagger.json @@ -43,7 +43,7 @@ "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/sdkalphaEmpty" + "$ref": "#/definitions/alphaEmpty" } } }, @@ -182,245 +182,6 @@ "SDK" ] } - }, - "/v1alpha1/counters/{counterUpdateRequest.name}": { - "patch": { - "summary": "UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated).\nReturns OUT_OF_RANGE if the Count is out of range [0,Capacity].", - "operationId": "UpdateCounter", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaCounter" - } - } - }, - "parameters": [ - { - "name": "counterUpdateRequest.name", - "description": "The name of the Counter to update", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "counterUpdateRequest", - "description": "The requested update to make to the Counter", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "count": { - "type": "string", - "format": "int64", - "title": "The value to set the Counter Count" - }, - "capacity": { - "type": "string", - "format": "int64", - "title": "The value to set the Counter Capacity" - }, - "countDiff": { - "type": "string", - "format": "int64", - "title": "countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement\n(negative), 0 if a CountSet or CapacitySet request" - } - }, - "title": "The requested update to make to the Counter" - } - } - ], - "tags": [ - "SDK" - ] - } - }, - "/v1alpha1/counters/{name}": { - "get": { - "summary": "Gets a Counter. Returns NOT_FOUND if the Counter does not exist.", - "operationId": "GetCounter", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaCounter" - } - } - }, - "parameters": [ - { - "name": "name", - "description": "The name of the Counter to get", - "in": "path", - "required": true, - "type": "string" - } - ], - "tags": [ - "SDK" - ] - } - }, - "/v1alpha1/lists/{list.name}": { - "patch": { - "summary": "UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated).\n**THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES**\nUse AddListValue() or RemoveListValue() for modifying the List.Values field.\nReturns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List.\nIf a field mask path(s) is specified, but the value is not set in the request List object,\nthen the default value for the variable will be set (i.e. 0 for \"capacity\", empty list for \"values\").", - "operationId": "UpdateList", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaList" - } - } - }, - "parameters": [ - { - "name": "list.name", - "description": "The name of the List", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "list", - "description": "The List to update", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "capacity": { - "type": "string", - "format": "int64", - "title": "The maximum capacity of the List" - }, - "values": { - "type": "array", - "items": { - "type": "string" - }, - "title": "The array of items in the List [\"v1\", \"v2\", …]" - } - }, - "title": "The List to update" - } - } - ], - "tags": [ - "SDK" - ] - } - }, - "/v1alpha1/lists/{name}": { - "get": { - "summary": "Gets a List. Returns NOT_FOUND if the List does not exist.", - "operationId": "GetList", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaList" - } - } - }, - "parameters": [ - { - "name": "name", - "description": "The name of the List to get", - "in": "path", - "required": true, - "type": "string" - } - ], - "tags": [ - "SDK" - ] - } - }, - "/v1alpha1/lists/{name}:addValue": { - "post": { - "summary": "Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist.\nReturns ALREADY_EXISTS if the value is already in the List.\nReturns OUT_OF_RANGE if the List is already at Capacity.", - "operationId": "AddListValue", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaList" - } - } - }, - "parameters": [ - { - "name": "name", - "description": "The name of the List to add a value to.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "required": [ - "value" - ] - } - } - ], - "tags": [ - "SDK" - ] - } - }, - "/v1alpha1/lists/{name}:removeValue": { - "post": { - "summary": "Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist.\nReturns NOT_FOUND if the value is not in the List.", - "operationId": "RemoveListValue", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/alphaList" - } - } - }, - "parameters": [ - { - "name": "name", - "description": "The name of the List to remove a value from.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "required": [ - "value" - ] - } - } - ], - "tags": [ - "SDK" - ] - } } }, "definitions": { @@ -444,72 +205,9 @@ }, "description": "Store a count variable." }, - "alphaCounter": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "The name of the Counter" - }, - "count": { - "type": "string", - "format": "int64", - "title": "The current count of the Counter" - }, - "capacity": { - "type": "string", - "format": "int64", - "title": "The maximum capacity of the Counter" - } - }, - "description": "A representation of a Counter." - }, - "alphaCounterUpdateRequest": { - "type": "object", - "properties": { - "name": { - "type": "string", - "title": "The name of the Counter to update" - }, - "count": { - "type": "string", - "format": "int64", - "title": "The value to set the Counter Count" - }, - "capacity": { - "type": "string", - "format": "int64", - "title": "The value to set the Counter Capacity" - }, - "countDiff": { - "type": "string", - "format": "int64", - "title": "countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement\n(negative), 0 if a CountSet or CapacitySet request" - } - }, - "description": "A representation of a Counter Update Request." - }, - "alphaList": { + "alphaEmpty": { "type": "object", - "properties": { - "name": { - "type": "string", - "title": "The name of the List" - }, - "capacity": { - "type": "string", - "format": "int64", - "title": "The maximum capacity of the List" - }, - "values": { - "type": "array", - "items": { - "type": "string" - }, - "title": "The array of items in the List [\"v1\", \"v2\", …]" - } - }, - "description": "A representation of a List." + "title": "I am Empty" }, "alphaPlayerID": { "type": "object", @@ -531,10 +229,6 @@ } }, "title": "List of Player IDs" - }, - "sdkalphaEmpty": { - "type": "object", - "title": "I am Empty" } } } diff --git a/sdks/swagger/beta.swagger.json b/sdks/swagger/beta.swagger.json index 81607ee439..cc73a3badb 100644 --- a/sdks/swagger/beta.swagger.json +++ b/sdks/swagger/beta.swagger.json @@ -4,6 +4,11 @@ "title": "beta.proto", "version": "version not set" }, + "tags": [ + { + "name": "SDK" + } + ], "schemes": [ "http" ], @@ -13,6 +18,314 @@ "produces": [ "application/json" ], - "paths": {}, - "definitions": {} + "paths": { + "/v1beta1/counters/{counterUpdateRequest.name}": { + "patch": { + "summary": "UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated).\nReturns OUT_OF_RANGE if the Count is out of range [0,Capacity].", + "operationId": "UpdateCounter", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/betaCounter" + } + } + }, + "parameters": [ + { + "name": "counterUpdateRequest.name", + "description": "The name of the Counter to update", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "counterUpdateRequest", + "description": "The requested update to make to the Counter", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "count": { + "type": "string", + "format": "int64", + "title": "The value to set the Counter Count" + }, + "capacity": { + "type": "string", + "format": "int64", + "title": "The value to set the Counter Capacity" + }, + "countDiff": { + "type": "string", + "format": "int64", + "title": "countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement\n(negative), 0 if a CountSet or CapacitySet request" + } + }, + "title": "The requested update to make to the Counter" + } + } + ], + "tags": [ + "SDK" + ] + } + }, + "/v1beta1/counters/{name}": { + "get": { + "summary": "Gets a Counter. Returns NOT_FOUND if the Counter does not exist.", + "operationId": "GetCounter", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/betaCounter" + } + } + }, + "parameters": [ + { + "name": "name", + "description": "The name of the Counter to get", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "SDK" + ] + } + }, + "/v1beta1/lists/{list.name}": { + "patch": { + "summary": "UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated).\n**THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES**\nUse AddListValue() or RemoveListValue() for modifying the List.Values field.\nReturns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List.\nIf a field mask path(s) is specified, but the value is not set in the request List object,\nthen the default value for the variable will be set (i.e. 0 for \"capacity\", empty list for \"values\").", + "operationId": "UpdateList", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/betaList" + } + } + }, + "parameters": [ + { + "name": "list.name", + "description": "The name of the List", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "list", + "description": "The List to update", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "capacity": { + "type": "string", + "format": "int64", + "title": "The maximum capacity of the List" + }, + "values": { + "type": "array", + "items": { + "type": "string" + }, + "title": "The array of items in the List [\"v1\", \"v2\", …]" + } + }, + "title": "The List to update" + } + } + ], + "tags": [ + "SDK" + ] + } + }, + "/v1beta1/lists/{name}": { + "get": { + "summary": "Gets a List. Returns NOT_FOUND if the List does not exist.", + "operationId": "GetList", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/betaList" + } + } + }, + "parameters": [ + { + "name": "name", + "description": "The name of the List to get", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "SDK" + ] + } + }, + "/v1beta1/lists/{name}:addValue": { + "post": { + "summary": "Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist.\nReturns ALREADY_EXISTS if the value is already in the List.\nReturns OUT_OF_RANGE if the List is already at Capacity.", + "operationId": "AddListValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/betaList" + } + } + }, + "parameters": [ + { + "name": "name", + "description": "The name of the List to add a value to.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "required": [ + "value" + ] + } + } + ], + "tags": [ + "SDK" + ] + } + }, + "/v1beta1/lists/{name}:removeValue": { + "post": { + "summary": "Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist.\nReturns NOT_FOUND if the value is not in the List.", + "operationId": "RemoveListValue", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/betaList" + } + } + }, + "parameters": [ + { + "name": "name", + "description": "The name of the List to remove a value from.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "required": [ + "value" + ] + } + } + ], + "tags": [ + "SDK" + ] + } + } + }, + "definitions": { + "betaCounter": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "The name of the Counter" + }, + "count": { + "type": "string", + "format": "int64", + "title": "The current count of the Counter" + }, + "capacity": { + "type": "string", + "format": "int64", + "title": "The maximum capacity of the Counter" + } + }, + "description": "A representation of a Counter." + }, + "betaCounterUpdateRequest": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "The name of the Counter to update" + }, + "count": { + "type": "string", + "format": "int64", + "title": "The value to set the Counter Count" + }, + "capacity": { + "type": "string", + "format": "int64", + "title": "The value to set the Counter Capacity" + }, + "countDiff": { + "type": "string", + "format": "int64", + "title": "countDiff tracks if a Counter Update Request is CountIncrement (positive), CountDecrement\n(negative), 0 if a CountSet or CapacitySet request" + } + }, + "description": "A representation of a Counter Update Request." + }, + "betaList": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "The name of the List" + }, + "capacity": { + "type": "string", + "format": "int64", + "title": "The maximum capacity of the List" + }, + "values": { + "type": "array", + "items": { + "type": "string" + }, + "title": "The array of items in the List [\"v1\", \"v2\", …]" + } + }, + "description": "A representation of a List." + } + } } diff --git a/sdks/swagger/sdk.swagger.json b/sdks/swagger/sdk.swagger.json index 291d8582cf..91c740e4bb 100644 --- a/sdks/swagger/sdk.swagger.json +++ b/sdks/swagger/sdk.swagger.json @@ -347,7 +347,7 @@ "format": "int64" } }, - "title": "[Stage:Alpha]\n[FeatureFlag:CountsAndLists]" + "title": "[Stage:Beta]\n[FeatureFlag:CountsAndLists]" }, "StatusListStatus": { "type": "object", @@ -363,7 +363,7 @@ } } }, - "title": "[Stage:Alpha]\n[FeatureFlag:CountsAndLists]" + "title": "[Stage:Beta]\n[FeatureFlag:CountsAndLists]" }, "StatusPlayerStatus": { "type": "object", @@ -458,14 +458,14 @@ "additionalProperties": { "$ref": "#/definitions/StatusCounterStatus" }, - "title": "[Stage:Alpha]\n[FeatureFlag:CountsAndLists]" + "title": "[Stage:Beta]\n[FeatureFlag:CountsAndLists]" }, "lists": { "type": "object", "additionalProperties": { "$ref": "#/definitions/StatusListStatus" }, - "title": "[Stage:Alpha]\n[FeatureFlag:CountsAndLists]" + "title": "[Stage:Beta]\n[FeatureFlag:CountsAndLists]" } } }, diff --git a/site/config.toml b/site/config.toml index 3be082d4b6..a32e020ed8 100644 --- a/site/config.toml +++ b/site/config.toml @@ -100,7 +100,7 @@ dev_eks_example_cluster_version = "1.29" dev_minikube_example_cluster_version = "1.28.6" # example tag -example_image_tag = "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31" +example_image_tag = "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32" # Enable syntax highlighting and copy buttons on code blocks with Prism prism_syntax_highlighting = true diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go index c25fca6a71..72f20f079c 100644 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -150,7 +150,7 @@ func NewFromFlags() (*Framework, error) { } viper.SetDefault(kubeconfigFlag, filepath.Join(usr.HomeDir, ".kube", "config")) - viper.SetDefault(gsimageFlag, "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31") + viper.SetDefault(gsimageFlag, "us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32") viper.SetDefault(pullSecretFlag, "") viper.SetDefault(stressTestLevelFlag, 0) viper.SetDefault(perfOutputDirFlag, "") diff --git a/test/e2e/gameserver_test.go b/test/e2e/gameserver_test.go index 71ec281a13..cc2cf32a5b 100644 --- a/test/e2e/gameserver_test.go +++ b/test/e2e/gameserver_test.go @@ -1110,7 +1110,7 @@ spec: preferredDuringSchedulingIgnoredDuringExecution: ERROR containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 ` err := os.WriteFile("/tmp/invalid.yaml", []byte(gsYaml), 0o644) require.NoError(t, err) diff --git a/test/load/allocation/fleet.yaml b/test/load/allocation/fleet.yaml index 0f40b11dbc..93aae8f211 100644 --- a/test/load/allocation/fleet.yaml +++ b/test/load/allocation/fleet.yaml @@ -33,7 +33,7 @@ spec: spec: containers: - args: [-automaticShutdownDelaySec=600] - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 name: simple-game-server resources: limits: diff --git a/test/load/allocation/performance-test-fleet-template.yaml b/test/load/allocation/performance-test-fleet-template.yaml index 5dd0a2cd90..12920e441a 100644 --- a/test/load/allocation/performance-test-fleet-template.yaml +++ b/test/load/allocation/performance-test-fleet-template.yaml @@ -33,7 +33,7 @@ spec: spec: containers: - args: [-automaticShutdownDelaySec=AUTOMATIC_SHUTDOWN_DELAY_SEC_REPLACEMENT] - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 name: simple-game-server resources: limits: diff --git a/test/load/allocation/scenario-fleet.yaml b/test/load/allocation/scenario-fleet.yaml index 691a15606c..ac9674ac97 100644 --- a/test/load/allocation/scenario-fleet.yaml +++ b/test/load/allocation/scenario-fleet.yaml @@ -38,7 +38,7 @@ spec: value: 'true' containers: - name: simple-game-server - image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.31 + image: us-docker.pkg.dev/agones-images/examples/simple-game-server:0.32 args: [-automaticShutdownDelaySec=60, -readyIterations=10] resources: limits: diff --git a/test/sdk/csharp/Program.cs b/test/sdk/csharp/Program.cs index 8325e58781..3817e1e466 100644 --- a/test/sdk/csharp/Program.cs +++ b/test/sdk/csharp/Program.cs @@ -169,12 +169,12 @@ if (featureGates.Contains("CountsAndLists")) // Tests are expected to run sequentially on the same pre-defined Counter in the localsdk server { - var alpha = sdk.Alpha(); + var beta = sdk.Beta(); var key = "rooms"; { var wantCount = 1; - var task = alpha.GetCounterCountAsync(key); + var task = beta.GetCounterCountAsync(key); task.Wait(); var gotCount = task.Result; if (wantCount != gotCount) @@ -189,7 +189,7 @@ var increment = 9; try { - var task = alpha.IncrementCounterAsync(key, increment); + var task = beta.IncrementCounterAsync(key, increment); task.Wait(); } catch (Exception e) @@ -198,7 +198,7 @@ Environment.Exit(1); } - var getTask = alpha.GetCounterCountAsync(key); + var getTask = beta.GetCounterCountAsync(key); getTask.Wait(); var gotCount = getTask.Result; if (wantCount != gotCount) @@ -213,7 +213,7 @@ var decrement = 5; try { - var task = alpha.DecrementCounterAsync(key, decrement); + var task = beta.DecrementCounterAsync(key, decrement); task.Wait(); } catch (Exception e) @@ -222,7 +222,7 @@ Environment.Exit(1); } - var getTask = alpha.GetCounterCountAsync(key); + var getTask = beta.GetCounterCountAsync(key); getTask.Wait(); var gotCount = getTask.Result; if (wantCount != gotCount) @@ -236,7 +236,7 @@ var wantCount = 3; try { - var task = alpha.SetCounterCountAsync(key, wantCount); + var task = beta.SetCounterCountAsync(key, wantCount); task.Wait(); } catch (Exception e) @@ -245,7 +245,7 @@ Environment.Exit(1); } - var getTask = alpha.GetCounterCountAsync(key); + var getTask = beta.GetCounterCountAsync(key); getTask.Wait(); var gotCount = getTask.Result; if (wantCount != gotCount) @@ -257,7 +257,7 @@ { var wantCapacity = 10; - var task = alpha.GetCounterCapacityAsync(key); + var task = beta.GetCounterCapacityAsync(key); task.Wait(); var gotCapacity = task.Result; if (wantCapacity != gotCapacity) @@ -272,7 +272,7 @@ var wantCapacity = 0; try { - var task = alpha.SetCounterCapacityAsync(key, wantCapacity); + var task = beta.SetCounterCapacityAsync(key, wantCapacity); task.Wait(); } catch (Exception e) @@ -281,7 +281,7 @@ Environment.Exit(1); } - var getTask = alpha.GetCounterCapacityAsync(key); + var getTask = beta.GetCounterCapacityAsync(key); getTask.Wait(); var gotCapacity = getTask.Result; if (wantCapacity != gotCapacity) @@ -295,12 +295,12 @@ if (featureGates.Contains("CountsAndLists")) // Tests are expected to run sequentially on the same pre-defined List in the localsdk server { - var alpha = sdk.Alpha(); + var beta = sdk.Beta(); var key = "players"; { var wantCapacity = 100; - var task = alpha.GetListCapacityAsync(key); + var task = beta.GetListCapacityAsync(key); task.Wait(); var gotCapacity = task.Result; if (wantCapacity != gotCapacity) @@ -314,7 +314,7 @@ var wantCapacity = 10; try { - var task = alpha.SetListCapacityAsync(key, wantCapacity); + var task = beta.SetListCapacityAsync(key, wantCapacity); task.Wait(); } catch (Exception e) @@ -323,7 +323,7 @@ Environment.Exit(1); } - var getTask = alpha.GetListCapacityAsync(key); + var getTask = beta.GetListCapacityAsync(key); getTask.Wait(); var gotCapacity = getTask.Result; if (wantCapacity != gotCapacity) @@ -336,7 +336,7 @@ { var value = "foo"; var want = false; - var task = alpha.ListContainsAsync(key, value); + var task = beta.ListContainsAsync(key, value); task.Wait(); var got = task.Result; if (want != got) @@ -346,7 +346,7 @@ } value = "test1"; want = true; - task = alpha.ListContainsAsync(key, value); + task = beta.ListContainsAsync(key, value); task.Wait(); got = task.Result; if (want != got) @@ -358,7 +358,7 @@ { IList wantValues = new List { "test0", "test1", "test2" }; - var task = alpha.GetListValuesAsync(key); + var task = beta.GetListValuesAsync(key); task.Wait(); var gotValues = task.Result; var equal = Enumerable.SequenceEqual(wantValues, gotValues); @@ -376,7 +376,7 @@ IList wantValues = new List { "test0", "test1", "test2", "test3" }; try { - var task = alpha.AppendListValueAsync(key, addValue); + var task = beta.AppendListValueAsync(key, addValue); task.Wait(); } catch (Exception e) @@ -385,7 +385,7 @@ Environment.Exit(1); } - var getTask = alpha.GetListValuesAsync(key); + var getTask = beta.GetListValuesAsync(key); getTask.Wait(); var gotValues = getTask.Result; var equal = Enumerable.SequenceEqual(wantValues, gotValues); @@ -403,7 +403,7 @@ IList wantValues = new List { "test0", "test1", "test3" }; try { - var task = alpha.DeleteListValueAsync(key, removeValue); + var task = beta.DeleteListValueAsync(key, removeValue); task.Wait(); } catch (Exception e) @@ -412,7 +412,7 @@ Environment.Exit(1); } - var getTask = alpha.GetListValuesAsync(key); + var getTask = beta.GetListValuesAsync(key); getTask.Wait(); var gotValues = getTask.Result; var equal = Enumerable.SequenceEqual(wantValues, gotValues); diff --git a/test/sdk/go/sdk-client-test.go b/test/sdk/go/sdk-client-test.go index 9a7705ddbb..a5c022e9f8 100644 --- a/test/sdk/go/sdk-client-test.go +++ b/test/sdk/go/sdk-client-test.go @@ -160,36 +160,36 @@ func testPlayerTracking(sdk *goSdk.SDK) { func testCounts(sdk *goSdk.SDK) { // LocalSDKServer starting "rooms": {Count: 1, Capacity: 10} counter := "rooms" - count, err := sdk.Alpha().GetCounterCount(counter) + count, err := sdk.Beta().GetCounterCount(counter) if err != nil { log.Fatalf("Error getting Counter count: %s", err) } else if count != int64(1) { log.Fatalf("Counter count should be 1, but is %d", count) } - err = sdk.Alpha().IncrementCounter(counter, 9) + err = sdk.Beta().IncrementCounter(counter, 9) if err != nil { log.Fatalf("Error incrementing Counter: %s", err) } - err = sdk.Alpha().DecrementCounter(counter, 10) + err = sdk.Beta().DecrementCounter(counter, 10) if err != nil { log.Fatalf("Error decrementing Counter: %s", err) } - err = sdk.Alpha().SetCounterCount(counter, 10) + err = sdk.Beta().SetCounterCount(counter, 10) if err != nil { log.Fatalf("Error setting Counter count: %s", err) } - capacity, err := sdk.Alpha().GetCounterCapacity(counter) + capacity, err := sdk.Beta().GetCounterCapacity(counter) if err != nil { log.Fatalf("Error getting Counter capacity: %s", err) } else if capacity != int64(10) { log.Fatalf("Counter capacity should be 10, but is %d", capacity) } - err = sdk.Alpha().SetCounterCapacity(counter, 1) + err = sdk.Beta().SetCounterCapacity(counter, 1) if err != nil { log.Fatalf("Error setting Counter capacity: %s", err) } @@ -200,43 +200,43 @@ func testLists(sdk *goSdk.SDK) { list := "players" vals := []string{"test0", "test1", "test2"} - contains, err := sdk.Alpha().ListContains(list, "test1") + contains, err := sdk.Beta().ListContains(list, "test1") if !contains { log.Fatalf("List should contain value \"test1\" err: %s", err) } - length, err := sdk.Alpha().GetListLength(list) + length, err := sdk.Beta().GetListLength(list) if err != nil { log.Fatalf("Error getting List length: %s", err) } else if int64(length) != 3 { log.Fatalf("List length should be 3, but is %d", length) } - values, err := sdk.Alpha().GetListValues(list) + values, err := sdk.Beta().GetListValues(list) if err != nil { log.Fatalf("Error getting List values: %s", err) } else if !cmp.Equal(vals, values) { log.Fatalf("List values should be %v, but is %v", vals, values) } - err = sdk.Alpha().AppendListValue(list, "test3") + err = sdk.Beta().AppendListValue(list, "test3") if err != nil { log.Fatalf("Unable to append value \"test3\" err: %s", err) } - err = sdk.Alpha().DeleteListValue(list, "test2") + err = sdk.Beta().DeleteListValue(list, "test2") if err != nil { log.Fatalf("Unable to delete value \"test2\" err: %s", err) } - capacity, err := sdk.Alpha().GetListCapacity(list) + capacity, err := sdk.Beta().GetListCapacity(list) if err != nil { log.Fatalf("Error getting List capacity: %s", err) } else if capacity != int64(100) { log.Fatalf("List capacity should be 100, but is %d", capacity) } - err = sdk.Alpha().SetListCapacity(list, 2) + err = sdk.Beta().SetListCapacity(list, 2) if err != nil { log.Fatalf("Error setting List capacity: %s", err) } diff --git a/test/sdk/restapi/alpha/swagger/api_sdk.go b/test/sdk/restapi/alpha/swagger/api_sdk.go index 4f9afb63ef..f30cc7442d 100644 --- a/test/sdk/restapi/alpha/swagger/api_sdk.go +++ b/test/sdk/restapi/alpha/swagger/api_sdk.go @@ -40,93 +40,6 @@ var ( type SDKApiService service /* -SDKApiService Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. Returns ALREADY_EXISTS if the value is already in the List. Returns OUT_OF_RANGE if the List is already at Capacity. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - * @param name The name of the List to add a value to. -@return AlphaList -*/ -func (a *SDKApiService) AddListValue(ctx context.Context, body ListsNameaddValueBody, name string) (AlphaList, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaList - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1alpha1/lists/{name}:addValue" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaList - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* SDKApiService Returns the list of the currently connected player ids. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. If GameServer.Status.Players.IDs is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -210,174 +123,6 @@ func (a *SDKApiService) GetConnectedPlayers(ctx context.Context) (AlphaPlayerIdL return localVarReturnValue, localVarHttpResponse, nil } /* -SDKApiService Gets a Counter. Returns NOT_FOUND if the Counter does not exist. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param name The name of the Counter to get -@return AlphaCounter -*/ -func (a *SDKApiService) GetCounter(ctx context.Context, name string) (AlphaCounter, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaCounter - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1alpha1/counters/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaCounter - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService Gets a List. Returns NOT_FOUND if the List does not exist. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param name The name of the List to get -@return AlphaList -*/ -func (a *SDKApiService) GetList(ctx context.Context, name string) (AlphaList, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Get") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaList - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1alpha1/lists/{name}" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaList - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* SDKApiService Retrieves the current player capacity. This is always accurate from what has been set through this SDK, even if the value has yet to be updated on the GameServer status resource. If GameServer.Status.Players.Capacity is set manually through the Kubernetes API, use SDK.GameServer() or SDK.WatchGameServer() instead to view this value. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @@ -801,105 +546,18 @@ func (a *SDKApiService) PlayerDisconnect(ctx context.Context, body AlphaPlayerId return localVarReturnValue, localVarHttpResponse, nil } /* -SDKApiService Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. Returns NOT_FOUND if the value is not in the List. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body - * @param name The name of the List to remove a value from. -@return AlphaList -*/ -func (a *SDKApiService) RemoveListValue(ctx context.Context, body ListsNameremoveValueBody, name string) (AlphaList, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Post") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaList - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1alpha1/lists/{name}:removeValue" - localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaList - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* SDKApiService Update the GameServer.Status.Players.Capacity value with a new capacity. * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param body Store a count variable. -@return SdkalphaEmpty +@return AlphaEmpty */ -func (a *SDKApiService) SetPlayerCapacity(ctx context.Context, body AlphaCount) (SdkalphaEmpty, *http.Response, error) { +func (a *SDKApiService) SetPlayerCapacity(ctx context.Context, body AlphaCount) (AlphaEmpty, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte - localVarReturnValue SdkalphaEmpty + localVarReturnValue AlphaEmpty ) // create path and map variables @@ -958,181 +616,7 @@ func (a *SDKApiService) SetPlayerCapacity(ctx context.Context, body AlphaCount) error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { - var v SdkalphaEmpty - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body The requested update to make to the Counter - * @param counterUpdateRequestName The name of the Counter to update -@return AlphaCounter -*/ -func (a *SDKApiService) UpdateCounter(ctx context.Context, body TheRequestedUpdateToMakeToTheCounter, counterUpdateRequestName string) (AlphaCounter, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaCounter - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1alpha1/counters/{counterUpdateRequest.name}" - localVarPath = strings.Replace(localVarPath, "{"+"counterUpdateRequest.name"+"}", fmt.Sprintf("%v", counterUpdateRequestName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaCounter - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v - return localVarReturnValue, localVarHttpResponse, newErr - } - return localVarReturnValue, localVarHttpResponse, newErr - } - - return localVarReturnValue, localVarHttpResponse, nil -} -/* -SDKApiService UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** Use AddListValue() or RemoveListValue() for modifying the List.Values field. Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. If a field mask path(s) is specified, but the value is not set in the request List object, then the default value for the variable will be set (i.e. 0 for \"capacity\", empty list for \"values\"). - * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - * @param body The List to update - * @param listName The name of the List -@return AlphaList -*/ -func (a *SDKApiService) UpdateList(ctx context.Context, body TheListToUpdate, listName string) (AlphaList, *http.Response, error) { - var ( - localVarHttpMethod = strings.ToUpper("Patch") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte - localVarReturnValue AlphaList - ) - - // create path and map variables - localVarPath := a.client.cfg.BasePath + "/v1alpha1/lists/{list.name}" - localVarPath = strings.Replace(localVarPath, "{"+"list.name"+"}", fmt.Sprintf("%v", listName), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) - if localVarHttpContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHttpContentType - } - - // to determine the Accept header - localVarHttpHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) - if localVarHttpHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHttpHeaderAccept - } - // body params - localVarPostBody = &body - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHttpResponse, err := a.client.callAPI(r) - if err != nil || localVarHttpResponse == nil { - return localVarReturnValue, localVarHttpResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) - localVarHttpResponse.Body.Close() - if err != nil { - return localVarReturnValue, localVarHttpResponse, err - } - - if localVarHttpResponse.StatusCode < 300 { - // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err == nil { - return localVarReturnValue, localVarHttpResponse, err - } - } - - if localVarHttpResponse.StatusCode >= 300 { - newErr := GenericSwaggerError{ - body: localVarBody, - error: localVarHttpResponse.Status, - } - if localVarHttpResponse.StatusCode == 200 { - var v AlphaList + var v AlphaEmpty err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() diff --git a/test/sdk/restapi/alpha/swagger/model_sdkalpha_empty.go b/test/sdk/restapi/alpha/swagger/model_alpha_empty.go similarity index 97% rename from test/sdk/restapi/alpha/swagger/model_sdkalpha_empty.go rename to test/sdk/restapi/alpha/swagger/model_alpha_empty.go index 8eda60e9da..7c652e8588 100644 --- a/test/sdk/restapi/alpha/swagger/model_sdkalpha_empty.go +++ b/test/sdk/restapi/alpha/swagger/model_alpha_empty.go @@ -23,5 +23,5 @@ */ package swagger -type SdkalphaEmpty struct { +type AlphaEmpty struct { } diff --git a/test/sdk/restapi/beta/swagger/api_sdk.go b/test/sdk/restapi/beta/swagger/api_sdk.go new file mode 100644 index 0000000000..3e42fe82ca --- /dev/null +++ b/test/sdk/restapi/beta/swagger/api_sdk.go @@ -0,0 +1,557 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. + +/* + * beta.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package swagger + +import ( + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" + "fmt" +) + +// Linger please +var ( + _ context.Context +) + +type SDKApiService service +/* +SDKApiService Adds a value to a List and returns updated List. Returns NOT_FOUND if the List does not exist. Returns ALREADY_EXISTS if the value is already in the List. Returns OUT_OF_RANGE if the List is already at Capacity. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param name The name of the List to add a value to. +@return BetaList +*/ +func (a *SDKApiService) AddListValue(ctx context.Context, body ListsNameaddValueBody, name string) (BetaList, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BetaList + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1beta1/lists/{name}:addValue" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BetaList + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SDKApiService Gets a Counter. Returns NOT_FOUND if the Counter does not exist. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name of the Counter to get +@return BetaCounter +*/ +func (a *SDKApiService) GetCounter(ctx context.Context, name string) (BetaCounter, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BetaCounter + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1beta1/counters/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BetaCounter + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SDKApiService Gets a List. Returns NOT_FOUND if the List does not exist. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param name The name of the List to get +@return BetaList +*/ +func (a *SDKApiService) GetList(ctx context.Context, name string) (BetaList, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Get") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BetaList + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1beta1/lists/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BetaList + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SDKApiService Removes a value from a List and returns updated List. Returns NOT_FOUND if the List does not exist. Returns NOT_FOUND if the value is not in the List. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body + * @param name The name of the List to remove a value from. +@return BetaList +*/ +func (a *SDKApiService) RemoveListValue(ctx context.Context, body ListsNameremoveValueBody, name string) (BetaList, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Post") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BetaList + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1beta1/lists/{name}:removeValue" + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", fmt.Sprintf("%v", name), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BetaList + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SDKApiService UpdateCounter returns the updated Counter. Returns NOT_FOUND if the Counter does not exist (name cannot be updated). Returns OUT_OF_RANGE if the Count is out of range [0,Capacity]. + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body The requested update to make to the Counter + * @param counterUpdateRequestName The name of the Counter to update +@return BetaCounter +*/ +func (a *SDKApiService) UpdateCounter(ctx context.Context, body TheRequestedUpdateToMakeToTheCounter, counterUpdateRequestName string) (BetaCounter, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BetaCounter + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1beta1/counters/{counterUpdateRequest.name}" + localVarPath = strings.Replace(localVarPath, "{"+"counterUpdateRequest.name"+"}", fmt.Sprintf("%v", counterUpdateRequestName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BetaCounter + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} +/* +SDKApiService UpdateList returns the updated List. Returns NOT_FOUND if the List does not exist (name cannot be updated). **THIS WILL OVERWRITE ALL EXISTING LIST.VALUES WITH ANY REQUEST LIST.VALUES** Use AddListValue() or RemoveListValue() for modifying the List.Values field. Returns INVALID_ARGUMENT if the field mask path(s) are not field(s) of the List. If a field mask path(s) is specified, but the value is not set in the request List object, then the default value for the variable will be set (i.e. 0 for \"capacity\", empty list for \"values\"). + * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param body The List to update + * @param listName The name of the List +@return BetaList +*/ +func (a *SDKApiService) UpdateList(ctx context.Context, body TheListToUpdate, listName string) (BetaList, *http.Response, error) { + var ( + localVarHttpMethod = strings.ToUpper("Patch") + localVarPostBody interface{} + localVarFileName string + localVarFileBytes []byte + localVarReturnValue BetaList + ) + + // create path and map variables + localVarPath := a.client.cfg.BasePath + "/v1beta1/lists/{list.name}" + localVarPath = strings.Replace(localVarPath, "{"+"list.name"+"}", fmt.Sprintf("%v", listName), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHttpContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHttpResponse, err := a.client.callAPI(r) + if err != nil || localVarHttpResponse == nil { + return localVarReturnValue, localVarHttpResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) + localVarHttpResponse.Body.Close() + if err != nil { + return localVarReturnValue, localVarHttpResponse, err + } + + if localVarHttpResponse.StatusCode < 300 { + // If we succeed, return the data, otherwise pass on to decode error. + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err == nil { + return localVarReturnValue, localVarHttpResponse, err + } + } + + if localVarHttpResponse.StatusCode >= 300 { + newErr := GenericSwaggerError{ + body: localVarBody, + error: localVarHttpResponse.Status, + } + if localVarHttpResponse.StatusCode == 200 { + var v BetaList + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr + } + return localVarReturnValue, localVarHttpResponse, newErr + } + + return localVarReturnValue, localVarHttpResponse, nil +} diff --git a/test/sdk/restapi/beta/swagger/client.go b/test/sdk/restapi/beta/swagger/client.go new file mode 100644 index 0000000000..77873a7586 --- /dev/null +++ b/test/sdk/restapi/beta/swagger/client.go @@ -0,0 +1,488 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. +/* + * beta.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package swagger + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile("(?i:[application|text]/json)") + xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)") +) + +// APIClient manages communication with the beta.proto API vversion not set +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + SDKApi *SDKApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.SDKApi = (*SDKApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } + + return fmt.Sprintf("%v", obj) +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + return c.cfg.HTTPClient.Do(request) +} + +// Change base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile("file", filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + } + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Override request host, if applicable + if c.cfg.Host != "" { + localVarRequest.Host = c.cfg.Host + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if strings.Contains(contentType, "application/xml") { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } else if strings.Contains(contentType, "application/json") { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } + expires = now.Add(lifetime) + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericSwaggerError Provides access to the body, error and model on returned errors. +type GenericSwaggerError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericSwaggerError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericSwaggerError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericSwaggerError) Model() interface{} { + return e.model +} diff --git a/test/sdk/restapi/beta/swagger/configuration.go b/test/sdk/restapi/beta/swagger/configuration.go new file mode 100644 index 0000000000..a57d3da59b --- /dev/null +++ b/test/sdk/restapi/beta/swagger/configuration.go @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. +/* + * beta.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package swagger + +import ( + "net/http" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + HTTPClient *http.Client +} + +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "/", + DefaultHeader: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", + } + return cfg +} + +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_counter.go b/test/sdk/restapi/beta/swagger/model_beta_counter.go similarity index 96% rename from test/sdk/restapi/alpha/swagger/model_alpha_counter.go rename to test/sdk/restapi/beta/swagger/model_beta_counter.go index 8fa2da790c..ed4becfae7 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_counter.go +++ b/test/sdk/restapi/beta/swagger/model_beta_counter.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * @@ -24,7 +24,7 @@ package swagger // A representation of a Counter. -type AlphaCounter struct { +type BetaCounter struct { Name string `json:"name,omitempty"` Count string `json:"count,omitempty"` Capacity string `json:"capacity,omitempty"` diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_counter_update_request.go b/test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go similarity index 95% rename from test/sdk/restapi/alpha/swagger/model_alpha_counter_update_request.go rename to test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go index c7127e16b1..1cbfa115db 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_counter_update_request.go +++ b/test/sdk/restapi/beta/swagger/model_beta_counter_update_request.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * @@ -24,7 +24,7 @@ package swagger // A representation of a Counter Update Request. -type AlphaCounterUpdateRequest struct { +type BetaCounterUpdateRequest struct { Name string `json:"name,omitempty"` Count string `json:"count,omitempty"` Capacity string `json:"capacity,omitempty"` diff --git a/test/sdk/restapi/alpha/swagger/model_alpha_list.go b/test/sdk/restapi/beta/swagger/model_beta_list.go similarity index 96% rename from test/sdk/restapi/alpha/swagger/model_alpha_list.go rename to test/sdk/restapi/beta/swagger/model_beta_list.go index c9cf307520..90e7fef01c 100644 --- a/test/sdk/restapi/alpha/swagger/model_alpha_list.go +++ b/test/sdk/restapi/beta/swagger/model_beta_list.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * @@ -24,7 +24,7 @@ package swagger // A representation of a List. -type AlphaList struct { +type BetaList struct { Name string `json:"name,omitempty"` Capacity string `json:"capacity,omitempty"` Values []string `json:"values,omitempty"` diff --git a/test/sdk/restapi/alpha/swagger/model_lists_nameadd_value_body.go b/test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go similarity index 98% rename from test/sdk/restapi/alpha/swagger/model_lists_nameadd_value_body.go rename to test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go index 934ee469ed..5656290a8c 100644 --- a/test/sdk/restapi/alpha/swagger/model_lists_nameadd_value_body.go +++ b/test/sdk/restapi/beta/swagger/model_lists_nameadd_value_body.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/test/sdk/restapi/alpha/swagger/model_lists_nameremove_value_body.go b/test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go similarity index 98% rename from test/sdk/restapi/alpha/swagger/model_lists_nameremove_value_body.go rename to test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go index ad57aa86fa..079b0751da 100644 --- a/test/sdk/restapi/alpha/swagger/model_lists_nameremove_value_body.go +++ b/test/sdk/restapi/beta/swagger/model_lists_nameremove_value_body.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/test/sdk/restapi/alpha/swagger/model_the_list_to_update.go b/test/sdk/restapi/beta/swagger/model_the_list_to_update.go similarity index 98% rename from test/sdk/restapi/alpha/swagger/model_the_list_to_update.go rename to test/sdk/restapi/beta/swagger/model_the_list_to_update.go index bf9d961a95..f4ce38ad61 100644 --- a/test/sdk/restapi/alpha/swagger/model_the_list_to_update.go +++ b/test/sdk/restapi/beta/swagger/model_the_list_to_update.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/test/sdk/restapi/alpha/swagger/model_the_requested_update_to_make_to_the_counter.go b/test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go similarity index 98% rename from test/sdk/restapi/alpha/swagger/model_the_requested_update_to_make_to_the_counter.go rename to test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go index c082bf1df1..ad1db867e0 100644 --- a/test/sdk/restapi/alpha/swagger/model_the_requested_update_to_make_to_the_counter.go +++ b/test/sdk/restapi/beta/swagger/model_the_requested_update_to_make_to_the_counter.go @@ -14,7 +14,7 @@ // This code was autogenerated. Do not edit directly. /* - * alpha.proto + * beta.proto * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * diff --git a/test/sdk/restapi/beta/swagger/response.go b/test/sdk/restapi/beta/swagger/response.go new file mode 100644 index 0000000000..06eef9f7f0 --- /dev/null +++ b/test/sdk/restapi/beta/swagger/response.go @@ -0,0 +1,57 @@ +// Copyright 2023 Google LLC All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was autogenerated. Do not edit directly. +/* + * beta.proto + * + * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) + * + * API version: version not set + * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) + */ +package swagger + +import ( + "net/http" +) + +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the swagger operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/test/sdk/restapi/http-api-test.go b/test/sdk/restapi/http-api-test.go index b53ebc92e4..4dc7b15361 100644 --- a/test/sdk/restapi/http-api-test.go +++ b/test/sdk/restapi/http-api-test.go @@ -20,10 +20,12 @@ import ( "strings" "time" - alpha "agones.dev/agones/test/sdk/restapi/alpha/swagger" - "agones.dev/agones/test/sdk/restapi/swagger" "github.com/google/go-cmp/cmp" "golang.org/x/net/context" + + alpha "agones.dev/agones/test/sdk/restapi/alpha/swagger" + beta "agones.dev/agones/test/sdk/restapi/beta/swagger" + "agones.dev/agones/test/sdk/restapi/swagger" ) func main() { @@ -38,6 +40,11 @@ func main() { alphaConf.BasePath = "http://localhost:" + portStr alphaCli := alpha.NewAPIClient(alphaConf) + log.Println("Beta Client is starting") + betaConf := beta.NewConfiguration() + betaConf.BasePath = "http://localhost:" + portStr + betaCli := beta.NewAPIClient(betaConf) + ctx := context.Background() // Wait for SDK server to start the test (15 seconds) @@ -121,8 +128,8 @@ func main() { } if strings.Contains(os.Getenv("FEATURE_GATES"), "CountsAndLists=true") { - testCounters(ctx, alphaCli) - testLists(ctx, alphaCli) + testCounters(ctx, betaCli) + testLists(ctx, betaCli) } else { log.Print("Counts and Lists not enabled, skipping.") } @@ -180,12 +187,12 @@ func testPlayers(ctx context.Context, alphaCli *alpha.APIClient) { } } -func testCounters(ctx context.Context, alphaCli *alpha.APIClient) { +func testCounters(ctx context.Context, betaCli *beta.APIClient) { // Tests are expected to run sequentially on the same pre-defined Counter in the localsdk server counterName := "rooms" - expectedCounter := alpha.AlphaCounter{Name: counterName, Count: "1", Capacity: "10"} - if counter, _, err := alphaCli.SDKApi.GetCounter(ctx, counterName); err != nil { + expectedCounter := beta.BetaCounter{Name: counterName, Count: "1", Capacity: "10"} + if counter, _, err := betaCli.SDKApi.GetCounter(ctx, counterName); err != nil { log.Fatalf("Error getting Counter: %s", err) } else { if !cmp.Equal(expectedCounter, counter) { @@ -194,8 +201,8 @@ func testCounters(ctx context.Context, alphaCli *alpha.APIClient) { } // Test updatecounter, setcapacitycounter - expectedCounter = alpha.AlphaCounter{Name: counterName, Count: "0", Capacity: "42"} - if counter, _, err := alphaCli.SDKApi.UpdateCounter(ctx, alpha.TheRequestedUpdateToMakeToTheCounter{CountDiff: "-1", Capacity: "42"}, counterName); err != nil { + expectedCounter = beta.BetaCounter{Name: counterName, Count: "0", Capacity: "42"} + if counter, _, err := betaCli.SDKApi.UpdateCounter(ctx, beta.TheRequestedUpdateToMakeToTheCounter{CountDiff: "-1", Capacity: "42"}, counterName); err != nil { log.Fatalf("Error getting Counter: %s", err) } else { if !cmp.Equal(expectedCounter, counter) { @@ -204,8 +211,8 @@ func testCounters(ctx context.Context, alphaCli *alpha.APIClient) { } // Test setcountcounter - expectedCounter = alpha.AlphaCounter{Name: counterName, Count: "40", Capacity: "42"} - if counter, _, err := alphaCli.SDKApi.UpdateCounter(ctx, alpha.TheRequestedUpdateToMakeToTheCounter{Count: "40", Capacity: "42"}, counterName); err != nil { + expectedCounter = beta.BetaCounter{Name: counterName, Count: "40", Capacity: "42"} + if counter, _, err := betaCli.SDKApi.UpdateCounter(ctx, beta.TheRequestedUpdateToMakeToTheCounter{Count: "40", Capacity: "42"}, counterName); err != nil { log.Fatalf("Error getting Counter: %s", err) } else { if !cmp.Equal(expectedCounter, counter) { @@ -214,12 +221,12 @@ func testCounters(ctx context.Context, alphaCli *alpha.APIClient) { } } -func testLists(ctx context.Context, alphaCli *alpha.APIClient) { +func testLists(ctx context.Context, betaCli *beta.APIClient) { // Tests are expected to run sequentially on the same pre-defined List in the localsdk server listName := "players" - expectedList := alpha.AlphaList{Name: listName, Values: []string{"test0", "test1", "test2"}, Capacity: "100"} - if list, _, err := alphaCli.SDKApi.GetList(ctx, listName); err != nil { + expectedList := beta.BetaList{Name: listName, Values: []string{"test0", "test1", "test2"}, Capacity: "100"} + if list, _, err := betaCli.SDKApi.GetList(ctx, listName); err != nil { log.Fatalf("Error getting List: %s", err) } else { if !cmp.Equal(expectedList, list) { @@ -227,8 +234,8 @@ func testLists(ctx context.Context, alphaCli *alpha.APIClient) { } } - expectedList = alpha.AlphaList{Name: listName, Values: []string{"test123", "test456"}, Capacity: "10"} - if list, _, err := alphaCli.SDKApi.UpdateList(ctx, alpha.TheListToUpdate{Values: []string{"test123", "test456"}, Capacity: "10"}, listName); err != nil { + expectedList = beta.BetaList{Name: listName, Values: []string{"test123", "test456"}, Capacity: "10"} + if list, _, err := betaCli.SDKApi.UpdateList(ctx, beta.TheListToUpdate{Values: []string{"test123", "test456"}, Capacity: "10"}, listName); err != nil { log.Fatalf("Error getting List: %s", err) } else { if !cmp.Equal(expectedList, list) { @@ -236,8 +243,8 @@ func testLists(ctx context.Context, alphaCli *alpha.APIClient) { } } - expectedList = alpha.AlphaList{Name: listName, Values: []string{"test123", "test456", "test789"}, Capacity: "10"} - if list, _, err := alphaCli.SDKApi.AddListValue(ctx, alpha.ListsNameaddValueBody{Value: "test789"}, listName); err != nil { + expectedList = beta.BetaList{Name: listName, Values: []string{"test123", "test456", "test789"}, Capacity: "10"} + if list, _, err := betaCli.SDKApi.AddListValue(ctx, beta.ListsNameaddValueBody{Value: "test789"}, listName); err != nil { log.Fatalf("Error getting List: %s", err) } else { if !cmp.Equal(expectedList, list) { @@ -245,8 +252,8 @@ func testLists(ctx context.Context, alphaCli *alpha.APIClient) { } } - expectedList = alpha.AlphaList{Name: listName, Values: []string{"test123", "test789"}, Capacity: "10"} - if list, _, err := alphaCli.SDKApi.RemoveListValue(ctx, alpha.ListsNameremoveValueBody{Value: "test456"}, listName); err != nil { + expectedList = beta.BetaList{Name: listName, Values: []string{"test123", "test789"}, Capacity: "10"} + if list, _, err := betaCli.SDKApi.RemoveListValue(ctx, beta.ListsNameremoveValueBody{Value: "test456"}, listName); err != nil { log.Fatalf("Error getting List: %s", err) } else { if !cmp.Equal(expectedList, list) {