Skip to content

Commit

Permalink
Reserve proto definition and generated code
Browse files Browse the repository at this point in the history
The proto file definition for the reserve status in #660,
and the generated clients from there.
  • Loading branch information
markmandel committed Jun 11, 2019
1 parent a358994 commit 6c8065f
Show file tree
Hide file tree
Showing 12 changed files with 1,306 additions and 250 deletions.
203 changes: 140 additions & 63 deletions pkg/sdk/sdk.pb.go

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions pkg/sdk/sdk.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions sdk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ service SDK {
body: "*"
};
}

// Marks the GameServer as the Reserved state for Duration
rpc Reserve(Duration) returns (Empty) {
option (google.api.http) = {
post: "/reserve"
body: "*"
};
}
}

// I am Empty
Expand All @@ -91,6 +99,11 @@ message KeyValue {
string value = 2;
}

// time duration, in seconds
message Duration {
int64 seconds = 1;
}

// A GameServer Custom Resource Definition object
// We will only export those resources that make the most
// sense. Can always expand to more as needed.
Expand Down
37 changes: 37 additions & 0 deletions sdk.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,33 @@
]
}
},
"/reserve": {
"post": {
"summary": "Marks the GameServer as the Reserved state for Duration",
"operationId": "Reserve",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/sdkEmpty"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/sdkDuration"
}
}
],
"tags": [
"SDK"
]
}
},
"/shutdown": {
"post": {
"summary": "Call when the GameServer is shutting down",
Expand Down Expand Up @@ -315,6 +342,16 @@
}
}
},
"sdkDuration": {
"type": "object",
"properties": {
"seconds": {
"type": "string",
"format": "int64"
}
},
"title": "time duration, in seconds"
},
"sdkEmpty": {
"type": "object",
"title": "I am Empty"
Expand Down
108 changes: 105 additions & 3 deletions sdks/cpp/include/agones/sdk.grpc.pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ class SDK final {
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>> PrepareAsyncSetAnnotation(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>>(PrepareAsyncSetAnnotationRaw(context, request, cq));
}
// Marks the GameServer as the Reserved state for Duration
virtual ::grpc::Status Reserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::stable::agones::dev::sdk::Empty* response) = 0;
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>> AsyncReserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>>(AsyncReserveRaw(context, request, cq));
}
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>> PrepareAsyncReserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>>(PrepareAsyncReserveRaw(context, request, cq));
}
class experimental_async_interface {
public:
virtual ~experimental_async_interface() {}
Expand All @@ -154,6 +162,8 @@ class SDK final {
virtual void SetLabel(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue* request, ::stable::agones::dev::sdk::Empty* response, std::function<void(::grpc::Status)>) = 0;
// Apply a Annotation to the backing GameServer metadata
virtual void SetAnnotation(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue* request, ::stable::agones::dev::sdk::Empty* response, std::function<void(::grpc::Status)>) = 0;
// Marks the GameServer as the Reserved state for Duration
virtual void Reserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response, std::function<void(::grpc::Status)>) = 0;
};
virtual class experimental_async_interface* experimental_async() { return nullptr; }
private:
Expand All @@ -175,6 +185,8 @@ class SDK final {
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>* PrepareAsyncSetLabelRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>* AsyncSetAnnotationRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>* PrepareAsyncSetAnnotationRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>* AsyncReserveRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) = 0;
virtual ::grpc::ClientAsyncResponseReaderInterface< ::stable::agones::dev::sdk::Empty>* PrepareAsyncReserveRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) = 0;
};
class Stub final : public StubInterface {
public:
Expand Down Expand Up @@ -239,6 +251,13 @@ class SDK final {
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>> PrepareAsyncSetAnnotation(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>>(PrepareAsyncSetAnnotationRaw(context, request, cq));
}
::grpc::Status Reserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::stable::agones::dev::sdk::Empty* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>> AsyncReserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>>(AsyncReserveRaw(context, request, cq));
}
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>> PrepareAsyncReserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>>(PrepareAsyncReserveRaw(context, request, cq));
}
class experimental_async final :
public StubInterface::experimental_async_interface {
public:
Expand All @@ -248,6 +267,7 @@ class SDK final {
void GetGameServer(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Empty* request, ::stable::agones::dev::sdk::GameServer* response, std::function<void(::grpc::Status)>) override;
void SetLabel(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue* request, ::stable::agones::dev::sdk::Empty* response, std::function<void(::grpc::Status)>) override;
void SetAnnotation(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue* request, ::stable::agones::dev::sdk::Empty* response, std::function<void(::grpc::Status)>) override;
void Reserve(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response, std::function<void(::grpc::Status)>) override;
private:
friend class Stub;
explicit experimental_async(Stub* stub): stub_(stub) { }
Expand Down Expand Up @@ -277,6 +297,8 @@ class SDK final {
::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>* PrepareAsyncSetLabelRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>* AsyncSetAnnotationRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>* PrepareAsyncSetAnnotationRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::KeyValue& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>* AsyncReserveRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientAsyncResponseReader< ::stable::agones::dev::sdk::Empty>* PrepareAsyncReserveRaw(::grpc::ClientContext* context, const ::stable::agones::dev::sdk::Duration& request, ::grpc::CompletionQueue* cq) override;
const ::grpc::internal::RpcMethod rpcmethod_Ready_;
const ::grpc::internal::RpcMethod rpcmethod_Allocate_;
const ::grpc::internal::RpcMethod rpcmethod_Shutdown_;
Expand All @@ -285,6 +307,7 @@ class SDK final {
const ::grpc::internal::RpcMethod rpcmethod_WatchGameServer_;
const ::grpc::internal::RpcMethod rpcmethod_SetLabel_;
const ::grpc::internal::RpcMethod rpcmethod_SetAnnotation_;
const ::grpc::internal::RpcMethod rpcmethod_Reserve_;
};
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());

Expand All @@ -308,6 +331,8 @@ class SDK final {
virtual ::grpc::Status SetLabel(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::KeyValue* request, ::stable::agones::dev::sdk::Empty* response);
// Apply a Annotation to the backing GameServer metadata
virtual ::grpc::Status SetAnnotation(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::KeyValue* request, ::stable::agones::dev::sdk::Empty* response);
// Marks the GameServer as the Reserved state for Duration
virtual ::grpc::Status Reserve(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response);
};
template <class BaseClass>
class WithAsyncMethod_Ready : public BaseClass {
Expand Down Expand Up @@ -469,7 +494,27 @@ class SDK final {
::grpc::Service::RequestAsyncUnary(7, context, request, response, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_Ready<WithAsyncMethod_Allocate<WithAsyncMethod_Shutdown<WithAsyncMethod_Health<WithAsyncMethod_GetGameServer<WithAsyncMethod_WatchGameServer<WithAsyncMethod_SetLabel<WithAsyncMethod_SetAnnotation<Service > > > > > > > > AsyncService;
template <class BaseClass>
class WithAsyncMethod_Reserve : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithAsyncMethod_Reserve() {
::grpc::Service::MarkMethodAsync(8);
}
~WithAsyncMethod_Reserve() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status Reserve(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestReserve(::grpc::ServerContext* context, ::stable::agones::dev::sdk::Duration* request, ::grpc::ServerAsyncResponseWriter< ::stable::agones::dev::sdk::Empty>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag);
}
};
typedef WithAsyncMethod_Ready<WithAsyncMethod_Allocate<WithAsyncMethod_Shutdown<WithAsyncMethod_Health<WithAsyncMethod_GetGameServer<WithAsyncMethod_WatchGameServer<WithAsyncMethod_SetLabel<WithAsyncMethod_SetAnnotation<WithAsyncMethod_Reserve<Service > > > > > > > > > AsyncService;
template <class BaseClass>
class WithGenericMethod_Ready : public BaseClass {
private:
Expand Down Expand Up @@ -607,6 +652,23 @@ class SDK final {
}
};
template <class BaseClass>
class WithGenericMethod_Reserve : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithGenericMethod_Reserve() {
::grpc::Service::MarkMethodGeneric(8);
}
~WithGenericMethod_Reserve() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status Reserve(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
};
template <class BaseClass>
class WithRawMethod_Ready : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
Expand Down Expand Up @@ -767,6 +829,26 @@ class SDK final {
}
};
template <class BaseClass>
class WithRawMethod_Reserve : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithRawMethod_Reserve() {
::grpc::Service::MarkMethodRaw(8);
}
~WithRawMethod_Reserve() override {
BaseClassMustBeDerivedFromService(this);
}
// disable synchronous version of this method
::grpc::Status Reserve(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
void RequestReserve(::grpc::ServerContext* context, ::grpc::ByteBuffer* request, ::grpc::ServerAsyncResponseWriter< ::grpc::ByteBuffer>* response, ::grpc::CompletionQueue* new_call_cq, ::grpc::ServerCompletionQueue* notification_cq, void *tag) {
::grpc::Service::RequestAsyncUnary(8, context, request, response, new_call_cq, notification_cq, tag);
}
};
template <class BaseClass>
class WithStreamedUnaryMethod_Ready : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
Expand Down Expand Up @@ -886,7 +968,27 @@ class SDK final {
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedSetAnnotation(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::stable::agones::dev::sdk::KeyValue,::stable::agones::dev::sdk::Empty>* server_unary_streamer) = 0;
};
typedef WithStreamedUnaryMethod_Ready<WithStreamedUnaryMethod_Allocate<WithStreamedUnaryMethod_Shutdown<WithStreamedUnaryMethod_GetGameServer<WithStreamedUnaryMethod_SetLabel<WithStreamedUnaryMethod_SetAnnotation<Service > > > > > > StreamedUnaryService;
template <class BaseClass>
class WithStreamedUnaryMethod_Reserve : public BaseClass {
private:
void BaseClassMustBeDerivedFromService(const Service *service) {}
public:
WithStreamedUnaryMethod_Reserve() {
::grpc::Service::MarkMethodStreamed(8,
new ::grpc::internal::StreamedUnaryHandler< ::stable::agones::dev::sdk::Duration, ::stable::agones::dev::sdk::Empty>(std::bind(&WithStreamedUnaryMethod_Reserve<BaseClass>::StreamedReserve, this, std::placeholders::_1, std::placeholders::_2)));
}
~WithStreamedUnaryMethod_Reserve() override {
BaseClassMustBeDerivedFromService(this);
}
// disable regular version of this method
::grpc::Status Reserve(::grpc::ServerContext* context, const ::stable::agones::dev::sdk::Duration* request, ::stable::agones::dev::sdk::Empty* response) override {
abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
}
// replace default version of method with streamed unary
virtual ::grpc::Status StreamedReserve(::grpc::ServerContext* context, ::grpc::ServerUnaryStreamer< ::stable::agones::dev::sdk::Duration,::stable::agones::dev::sdk::Empty>* server_unary_streamer) = 0;
};
typedef WithStreamedUnaryMethod_Ready<WithStreamedUnaryMethod_Allocate<WithStreamedUnaryMethod_Shutdown<WithStreamedUnaryMethod_GetGameServer<WithStreamedUnaryMethod_SetLabel<WithStreamedUnaryMethod_SetAnnotation<WithStreamedUnaryMethod_Reserve<Service > > > > > > > StreamedUnaryService;
template <class BaseClass>
class WithSplitStreamingMethod_WatchGameServer : public BaseClass {
private:
Expand All @@ -908,7 +1010,7 @@ class SDK final {
virtual ::grpc::Status StreamedWatchGameServer(::grpc::ServerContext* context, ::grpc::ServerSplitStreamer< ::stable::agones::dev::sdk::Empty,::stable::agones::dev::sdk::GameServer>* server_split_streamer) = 0;
};
typedef WithSplitStreamingMethod_WatchGameServer<Service > SplitStreamedService;
typedef WithStreamedUnaryMethod_Ready<WithStreamedUnaryMethod_Allocate<WithStreamedUnaryMethod_Shutdown<WithStreamedUnaryMethod_GetGameServer<WithSplitStreamingMethod_WatchGameServer<WithStreamedUnaryMethod_SetLabel<WithStreamedUnaryMethod_SetAnnotation<Service > > > > > > > StreamedService;
typedef WithStreamedUnaryMethod_Ready<WithStreamedUnaryMethod_Allocate<WithStreamedUnaryMethod_Shutdown<WithStreamedUnaryMethod_GetGameServer<WithSplitStreamingMethod_WatchGameServer<WithStreamedUnaryMethod_SetLabel<WithStreamedUnaryMethod_SetAnnotation<WithStreamedUnaryMethod_Reserve<Service > > > > > > > > StreamedService;
};

} // namespace sdk
Expand Down
Loading

0 comments on commit 6c8065f

Please sign in to comment.