@@ -52,9 +52,34 @@ export abstract class BuildBase extends cdk.Resource implements IBuild {
52
52
* The operating system that the game server binaries are built to run on.
53
53
*/
54
54
export enum OperatingSystem {
55
+ /**
56
+ * Amazon Linux operating system.
57
+ */
55
58
AMAZON_LINUX = 'AMAZON_LINUX' ,
59
+
60
+ /**
61
+ * Amazon Linux 2 operating system.
62
+ */
56
63
AMAZON_LINUX_2 = 'AMAZON_LINUX_2' ,
57
- WINDOWS_2012 = 'WINDOWS_2012'
64
+
65
+ /**
66
+ * Amazon Linux 2023 operating system.
67
+ */
68
+ AMAZON_LINUX_2023 = 'AMAZON_LINUX_2023' ,
69
+
70
+ /**
71
+ * Windows Server 2012 operating system.
72
+ *
73
+ * @deprecated If you have active fleets using the Windows Server 2012 operating system,
74
+ * you can continue to create new builds using this OS until October 10, 2023, when Microsoft ends its support.
75
+ * All others must use Windows Server 2016 when creating new Windows-based builds.
76
+ */
77
+ WINDOWS_2012 = 'WINDOWS_2012' ,
78
+
79
+ /**
80
+ * Windows Server 2016 operating system.
81
+ */
82
+ WINDOWS_2016 = 'WINDOWS_2016' ,
58
83
}
59
84
60
85
/**
@@ -137,6 +162,15 @@ export interface BuildProps {
137
162
* @default - a role will be created with default permissions.
138
163
*/
139
164
readonly role ?: iam . IRole ;
165
+
166
+ /**
167
+ * A server SDK version you used when integrating your game server build with Amazon GameLift.
168
+ *
169
+ * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-custom-intro.html
170
+ *
171
+ * @default - 4.0.2
172
+ */
173
+ readonly serverSdkVersion ?: string ;
140
174
}
141
175
142
176
/**
@@ -247,6 +281,8 @@ export class Build extends BuildBase {
247
281
}
248
282
}
249
283
284
+ this . validateServerSdkVersion ( props . serverSdkVersion ) ;
285
+
250
286
this . role = props . role ?? new iam . Role ( this , 'ServiceRole' , {
251
287
assumedBy : new iam . ServicePrincipal ( 'gamelift.amazonaws.com' ) ,
252
288
} ) ;
@@ -263,6 +299,7 @@ export class Build extends BuildBase {
263
299
objectVersion : content . s3Location && content . s3Location . objectVersion ,
264
300
roleArn : this . role . roleArn ,
265
301
} ,
302
+ serverSdkVersion : props . serverSdkVersion ,
266
303
} ) ;
267
304
268
305
resource . node . addDependency ( this . role ) ;
@@ -276,4 +313,13 @@ export class Build extends BuildBase {
276
313
} ) ;
277
314
}
278
315
316
+ private validateServerSdkVersion ( serverSdkVersion ?: string ) {
317
+ if ( serverSdkVersion === undefined || cdk . Token . isUnresolved ( serverSdkVersion ) ) return ;
318
+ if ( ! serverSdkVersion . match ( / ^ \d + \. \d + \. \d + $ / ) ) {
319
+ throw new Error ( `serverSdkVersion must be in the 0.0.0 format, got \'${ serverSdkVersion } \'.` ) ;
320
+ }
321
+ if ( serverSdkVersion . length > 128 ) {
322
+ throw new Error ( `serverSdkVersion length must be smaller than or equal to 128, got ${ serverSdkVersion . length } .` ) ;
323
+ }
324
+ }
279
325
}
0 commit comments