agones.dev/agones@v1.53.0/sdks/nodejs/src/agonesSDK.d.ts (about) 1 // Copyright 2023 Google LLC All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 import Alpha from './alpha'; 16 17 type Seconds = number; 18 19 type GameServer = { 20 objectMeta: { 21 name: string; 22 namespace: string; 23 uid: string; 24 resourceVersion: string; 25 generation: number; 26 creationTimestamp: number; 27 deletionTimestamp: number; 28 annotationsMap: [string, string][]; 29 labelsMap: [string, string][]; 30 }; 31 spec: { 32 health: { 33 disabled: boolean; 34 periodSeconds: number; 35 failureThreshold: number; 36 initialDelaySeconds: number; 37 }; 38 }; 39 status: { 40 state: 41 | 'Scheduled' 42 | 'Reserved' 43 | 'RequestReady' 44 | 'Ready' 45 | 'Shutdown' 46 | 'Allocated' 47 | 'Unhealthy'; 48 address: string; 49 portsList: { 50 name: string; 51 port: number; 52 }[]; 53 }; 54 }; 55 56 export declare class AgonesSDK { 57 constructor(); 58 59 alpha: Alpha 60 61 get port(): string 62 63 connect(): Promise<void> 64 65 close(): void 66 67 ready(): Promise<Record<string, any>> 68 69 allocate(): Promise<Record<string, any>> 70 71 shutdown(): Promise<Record<string, any>> 72 73 health(errorCallback: (error: any) => any): void 74 75 getGameServer(): Promise<GameServer> 76 77 watchGameServer(callback: (gameServer: GameServer) => any, errorCallback: (error: any) => any): void 78 79 setLabel(key: string, value: string): Promise<Record<string, any>> 80 81 setAnnotation(key: string, value: string): Promise<Record<string, any>> 82 83 reserve(duration: Seconds): Promise<Record<string, any>> 84 } 85 86 export default AgonesSDK