Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
feat: add secret rotation schemas (#15)
Browse files Browse the repository at this point in the history
* chore: upgrade dependencies

* feat: add apigateway schemas

* feat: add eventbridge schemas

* feat: add firehose schemas

* feat: add lambda schemas

* feat: add kinesis schemas

* feat: add s3 schemas

* feat: add s3 batch schemas

* feat: add secret rotation schemas
  • Loading branch information
pevisscher authored Nov 30, 2022
1 parent 7a8982a commit a969285
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/aws/secret-rotation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './secret-rotation.type'

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

9 changes: 9 additions & 0 deletions src/lib/aws/secret-rotation/secret-rotation.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { $validator, $object, $string, $enum } from '@skyleague/therefore'

export const secretRotationEvent = $validator(
$object({
Step: $enum(['createSecret', 'finishSecret', 'setSecret', 'testSecret']),
SecretId: $string,
ClientRequestToken: $string,
})
)
8 changes: 8 additions & 0 deletions src/lib/aws/secret-rotation/secret-rotation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { SecretRotationEvent } from './secret-rotation.type'

import type { SecretsManagerRotationEvent as LambdaSecretRotationEvent } from 'aws-lambda'

test('type is compatible', () => {
const _test: SecretRotationEvent = {} as unknown as LambdaSecretRotationEvent
const _test2: LambdaSecretRotationEvent = {} as unknown as SecretRotationEvent
})
29 changes: 29 additions & 0 deletions src/lib/aws/secret-rotation/secret-rotation.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Generated by @skyleague/therefore@v1.0.0-local
* Do not manually touch this
*/
/* eslint-disable */
import AjvValidator from 'ajv'
import type { ValidateFunction } from 'ajv'

export interface SecretRotationEvent {
Step: 'createSecret' | 'finishSecret' | 'setSecret' | 'testSecret'
SecretId: string
ClientRequestToken: string
}

export const SecretRotationEvent = {
validate: require('./schemas/secret-rotation-event.schema.js') as ValidateFunction<SecretRotationEvent>,
get schema() {
return SecretRotationEvent.validate.schema
},
get errors() {
return SecretRotationEvent.validate.errors ?? undefined
},
is: (o: unknown): o is SecretRotationEvent => SecretRotationEvent.validate(o) === true,
assert: (o: unknown) => {
if (!SecretRotationEvent.validate(o)) {
throw new AjvValidator.ValidationError(SecretRotationEvent.errors ?? [])
}
},
} as const

0 comments on commit a969285

Please sign in to comment.