@@ -34,6 +34,7 @@ import type {
3434 DeleteInstanceACLRulesResponse ,
3535 DeleteInstanceSettingsRequest ,
3636 DeleteInstanceSettingsResponse ,
37+ EncryptionAtRest ,
3738 Endpoint ,
3839 EndpointDirectAccessDetails ,
3940 EndpointLoadBalancerDetails ,
@@ -267,6 +268,18 @@ export const unmarshalBackupSchedule = (data: unknown): BackupSchedule => {
267268 } as BackupSchedule
268269}
269270
271+ const unmarshalEncryptionAtRest = ( data : unknown ) : EncryptionAtRest => {
272+ if ( ! isJSONObject ( data ) ) {
273+ throw new TypeError (
274+ `Unmarshalling the type 'EncryptionAtRest' failed as data isn't a dictionary.` ,
275+ )
276+ }
277+
278+ return {
279+ enabled : data . enabled ,
280+ } as EncryptionAtRest
281+ }
282+
270283const unmarshalInstanceSetting = ( data : unknown ) : InstanceSetting => {
271284 if ( ! isJSONObject ( data ) ) {
272285 throw new TypeError (
@@ -335,6 +348,9 @@ export const unmarshalInstance = (data: unknown): Instance => {
335348 ? unmarshalBackupSchedule ( data . backup_schedule )
336349 : undefined ,
337350 createdAt : unmarshalDate ( data . created_at ) ,
351+ encryption : data . encryption
352+ ? unmarshalEncryptionAtRest ( data . encryption )
353+ : undefined ,
338354 endpoint : data . endpoint ? unmarshalEndpoint ( data . endpoint ) : undefined ,
339355 endpoints : unmarshalArrayOfObject ( data . endpoints , unmarshalEndpoint ) ,
340356 engine : data . engine ,
@@ -1002,12 +1018,23 @@ export const marshalCreateInstanceFromSnapshotRequest = (
10021018 node_type : request . nodeType ,
10031019} )
10041020
1021+ const marshalEncryptionAtRest = (
1022+ request : EncryptionAtRest ,
1023+ defaults : DefaultValues ,
1024+ ) : Record < string , unknown > => ( {
1025+ enabled : request . enabled ,
1026+ } )
1027+
10051028export const marshalCreateInstanceRequest = (
10061029 request : CreateInstanceRequest ,
10071030 defaults : DefaultValues ,
10081031) : Record < string , unknown > => ( {
10091032 backup_same_region : request . backupSameRegion ,
10101033 disable_backup : request . disableBackup ,
1034+ encryption :
1035+ request . encryption !== undefined
1036+ ? marshalEncryptionAtRest ( request . encryption , defaults )
1037+ : undefined ,
10111038 engine : request . engine ,
10121039 init_endpoints :
10131040 request . initEndpoints !== undefined
0 commit comments