Documentation
¶
Index ¶
- func RegisterModules()
- func ServerlessAPIHandler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
- func ServerlessECSHandler(ctx context.Context, event ECSInstanceStateEvent) (interface{}, error)
- type ECSInstanceStateDetail
- type ECSInstanceStateEvent
- type Server
- type ServerManager
- func (manager ServerManager) AddServerToDatabase(server Server) error
- func (manager ServerManager) CleanServerFromDatabase(identifier string) error
- func (manager ServerManager) CreateServer(identifier string) (core.Server, error)
- func (manager ServerManager) DeleteServer(server core.Server) error
- func (manager ServerManager) DeleteServerByIdentifier(identifier string) error
- func (manager ServerManager) GetServer(identifier string) (core.Server, error)
- func (manager ServerManager) GetServerCount() (uint, error)
- func (manager ServerManager) GetVpcSubnets() ([]*string, error)
- func (manager ServerManager) Initialize() error
- type ServerlessAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServerlessAPIHandler ¶
func ServerlessAPIHandler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
ServerlessAPIHandler passes the API gateway request event to Mux
func ServerlessECSHandler ¶
func ServerlessECSHandler(ctx context.Context, event ECSInstanceStateEvent) (interface{}, error)
ServerlessECSHandler runs when a game server task changes state
Types ¶
type ECSInstanceStateDetail ¶
type ECSInstanceStateDetail struct { Status string `json:"status"` DesiredStatus string `json:"desiredStatus"` TaskArn string `json:"taskArn"` }
ECSInstanceStateDetail holds detail level info
type ECSInstanceStateEvent ¶
type ECSInstanceStateEvent struct { ID string `json:"id"` Detail ECSInstanceStateDetail `json:"detail"` }
ECSInstanceStateEvent holds top level event details full event: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_cwe_events.html
type Server ¶
type Server struct { Identifier string `json:"identifier"` TaskArn string `json:"task"` Metadata map[string]string `json:"metadata"` // contains filtered or unexported fields }
Server represents a game server running on AWS
func (*Server) GetIdentifier ¶
GetIdentifier returns the identifier of a server
func (*Server) GetMetadata ¶
GetMetadata returns the metadata of a server
type ServerManager ¶
type ServerManager struct{}
ServerManager implements core.ServerManager to manage game servers on AWS
func (ServerManager) AddServerToDatabase ¶
func (manager ServerManager) AddServerToDatabase(server Server) error
AddServerToDatabase creates a new entry in Dynamo for a server object
func (ServerManager) CleanServerFromDatabase ¶
func (manager ServerManager) CleanServerFromDatabase(identifier string) error
CleanServerFromDatabase removes server info from Dynamo based on an identifier
func (ServerManager) CreateServer ¶
func (manager ServerManager) CreateServer(identifier string) (core.Server, error)
CreateServer runs a new ECS task with an associated identifier
func (ServerManager) DeleteServer ¶
func (manager ServerManager) DeleteServer(server core.Server) error
DeleteServer stops the ECS task associated with a server
func (ServerManager) DeleteServerByIdentifier ¶
func (manager ServerManager) DeleteServerByIdentifier(identifier string) error
DeleteServerByIdentifier gets a server object and passes it to DeleteServer()
func (ServerManager) GetServer ¶
func (manager ServerManager) GetServer(identifier string) (core.Server, error)
GetServer looks up grabs server data from DynamoDB
func (ServerManager) GetServerCount ¶
func (manager ServerManager) GetServerCount() (uint, error)
GetServerCount returns the number of tasks running in the ECS cluster
func (ServerManager) GetVpcSubnets ¶
func (manager ServerManager) GetVpcSubnets() ([]*string, error)
GetVpcSubnets returns a array of all subnets in the associated VPC
func (ServerManager) Initialize ¶
func (manager ServerManager) Initialize() error
Initialize setups AWS
type ServerlessAdapter ¶
type ServerlessAdapter struct{}
ServerlessAdapter implements functions to allow TetraControl to run serverlessly
func (ServerlessAdapter) IsServerless ¶
func (serverless ServerlessAdapter) IsServerless() bool
IsServerless returns true, if running in Lambda
func (ServerlessAdapter) Start ¶
func (serverless ServerlessAdapter) Start()
Start intializes and starts up the mux adapter