Skip to content

API Reference

Constructs

OpenApiAsyncDefinition

The OpenAPI Spec.

Initializers

import { OpenApiAsyncDefinition } from '@aws/pdk/type-safe-api'

new OpenApiAsyncDefinition(project: Project, options: OpenApiAsyncDefinitionOptions)
Name Type Description
project projen.Project No description.
options OpenApiAsyncDefinitionOptions No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { OpenApiAsyncDefinition } from '@aws/pdk/type-safe-api'

OpenApiAsyncDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { OpenApiAsyncDefinition } from '@aws/pdk/type-safe-api'

OpenApiAsyncDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
openApiSpecificationPath string Path to the root OpenAPI specification file.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the root OpenAPI specification file.


OpenApiAsyncModelProject

Project for defining an OpenAPI model for a WebSocket API.

Initializers

import { OpenApiAsyncModelProject } from '@aws/pdk/type-safe-api'

new OpenApiAsyncModelProject(options: OpenApiAsyncModelProjectOptions)
Name Type Description
options OpenApiAsyncModelProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { OpenApiAsyncModelProject } from '@aws/pdk/type-safe-api'

OpenApiAsyncModelProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { OpenApiAsyncModelProject } from '@aws/pdk/type-safe-api'

OpenApiAsyncModelProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { OpenApiAsyncModelProject } from '@aws/pdk/type-safe-api'

OpenApiAsyncModelProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
apiName string Name of the API.
definition OpenApiAsyncDefinition OpenAPI specification component.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


apiNameRequired
public readonly apiName: string;
  • Type: string

Name of the API.


definitionRequired
public readonly definition: OpenApiAsyncDefinition;

OpenAPI specification component.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


OpenApiDefinition

The OpenAPI Spec.

Initializers

import { OpenApiDefinition } from '@aws/pdk/type-safe-api'

new OpenApiDefinition(project: Project, options: OpenApiDefinitionOptions)
Name Type Description
project projen.Project No description.
options OpenApiDefinitionOptions No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { OpenApiDefinition } from '@aws/pdk/type-safe-api'

OpenApiDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { OpenApiDefinition } from '@aws/pdk/type-safe-api'

OpenApiDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
openApiSpecificationPath string Path to the root OpenAPI specification file.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the root OpenAPI specification file.


OpenApiModelProject

Project for defining an OpenAPI model for a REST API.

Initializers

import { OpenApiModelProject } from '@aws/pdk/type-safe-api'

new OpenApiModelProject(options: OpenApiModelProjectOptions)
Name Type Description
options OpenApiModelProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { OpenApiModelProject } from '@aws/pdk/type-safe-api'

OpenApiModelProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { OpenApiModelProject } from '@aws/pdk/type-safe-api'

OpenApiModelProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { OpenApiModelProject } from '@aws/pdk/type-safe-api'

OpenApiModelProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
apiName string Name of the API.
definition OpenApiDefinition OpenAPI specification component.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


apiNameRequired
public readonly apiName: string;
  • Type: string

Name of the API.


definitionRequired
public readonly definition: OpenApiDefinition;

OpenAPI specification component.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


OpenApiProjectDefinition

The OpenAPI Spec.

Initializers

import { OpenApiProjectDefinition } from '@aws/pdk/type-safe-api'

new OpenApiProjectDefinition(project: Project, _options: OpenApiProjectDefinitionOptions)
Name Type Description
project projen.Project No description.
_options OpenApiProjectDefinitionOptions No description.

projectRequired
  • Type: projen.Project

_optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { OpenApiProjectDefinition } from '@aws/pdk/type-safe-api'

OpenApiProjectDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { OpenApiProjectDefinition } from '@aws/pdk/type-safe-api'

OpenApiProjectDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
openApiSpecificationPath string Path to the root OpenAPI specification file.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the root OpenAPI specification file.


SmithyAsyncModelProject

Smithy model project for a WebSocket API.

Initializers

import { SmithyAsyncModelProject } from '@aws/pdk/type-safe-api'

new SmithyAsyncModelProject(options: SmithyAsyncModelProjectOptions)
Name Type Description
options SmithyAsyncModelProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addSmithyDeps Add a dependency on other smithy projects.
smithyProjectDefinition Returns the smithy project definition.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addSmithyDeps
public addSmithyDeps(deps: SmithyBaseProject): void

Add a dependency on other smithy projects.

depsRequired

smithyProjectDefinition
public smithyProjectDefinition(): SmithyProjectDefinition

Returns the smithy project definition.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { SmithyAsyncModelProject } from '@aws/pdk/type-safe-api'

SmithyAsyncModelProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { SmithyAsyncModelProject } from '@aws/pdk/type-safe-api'

SmithyAsyncModelProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { SmithyAsyncModelProject } from '@aws/pdk/type-safe-api'

SmithyAsyncModelProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
apiName string Name of the API.
definition SmithyServiceProjectDefinition Smithy model and build settings.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


apiNameRequired
public readonly apiName: string;
  • Type: string

Name of the API.


definitionRequired
public readonly definition: SmithyServiceProjectDefinition;

Smithy model and build settings.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


SmithyBaseProject

Base project for Smithy projects.

Initializers

import { SmithyBaseProject } from '@aws/pdk/type-safe-api'

new SmithyBaseProject(options: SmithyBaseProjectOptions)
Name Type Description
options SmithyBaseProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addSmithyDeps Add a dependency on other smithy projects.
smithyProjectDefinition Returns the smithy project definition.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addSmithyDeps
public addSmithyDeps(deps: SmithyBaseProject): void

Add a dependency on other smithy projects.

depsRequired

smithyProjectDefinition
public smithyProjectDefinition(): SmithyProjectDefinition

Returns the smithy project definition.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { SmithyBaseProject } from '@aws/pdk/type-safe-api'

SmithyBaseProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { SmithyBaseProject } from '@aws/pdk/type-safe-api'

SmithyBaseProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { SmithyBaseProject } from '@aws/pdk/type-safe-api'

SmithyBaseProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


SmithyModelProject

Smithy model project for a REST API.

Initializers

import { SmithyModelProject } from '@aws/pdk/type-safe-api'

new SmithyModelProject(options: SmithyModelProjectOptions)
Name Type Description
options SmithyModelProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addSmithyDeps Add a dependency on other smithy projects.
smithyProjectDefinition Returns the smithy project definition.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addSmithyDeps
public addSmithyDeps(deps: SmithyBaseProject): void

Add a dependency on other smithy projects.

depsRequired

smithyProjectDefinition
public smithyProjectDefinition(): SmithyProjectDefinition

Returns the smithy project definition.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { SmithyModelProject } from '@aws/pdk/type-safe-api'

SmithyModelProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { SmithyModelProject } from '@aws/pdk/type-safe-api'

SmithyModelProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { SmithyModelProject } from '@aws/pdk/type-safe-api'

SmithyModelProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
apiName string Name of the API.
definition SmithyServiceProjectDefinition Smithy model and build settings.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


apiNameRequired
public readonly apiName: string;
  • Type: string

Name of the API.


definitionRequired
public readonly definition: SmithyServiceProjectDefinition;

Smithy model and build settings.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


SmithyProjectDefinition

Definition for a Smithy project.

Initializers

import { SmithyProjectDefinition } from '@aws/pdk/type-safe-api'

new SmithyProjectDefinition(project: Project, options: SmithyProjectDefinitionOptions)
Name Type Description
project projen.Project No description.
options SmithyProjectDefinitionOptions No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.
addDeps Add maven-style or local file dependencies to the smithy model project.
addSmithyDeps Add dependencies on other smithy models, such that their shapes can be imported in this project.
addSources Add additional paths to model source files or directories.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

addDeps
public addDeps(deps: string): void

Add maven-style or local file dependencies to the smithy model project.

depsRequired
  • Type: string

dependencies to add, eg "software.amazon.smithy:smithy-validation-model:1.27.2" or "file://../some/path/build/lib/my-shapes.jar.


addSmithyDeps
public addSmithyDeps(deps: SmithyProjectDefinition): void

Add dependencies on other smithy models, such that their shapes can be imported in this project.

depsRequired

smithy definitions to depend on.


addSources
public addSources(sources: string): void

Add additional paths to model source files or directories.

Paths should be relative to the project outdir. Any absolute paths will be resolved as relative paths.

sourcesRequired
  • Type: string

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { SmithyProjectDefinition } from '@aws/pdk/type-safe-api'

SmithyProjectDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { SmithyProjectDefinition } from '@aws/pdk/type-safe-api'

SmithyProjectDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
gradleProjectName string Name of the gradle project.
modelDir string Directory of model source code.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

gradleProjectNameRequired
public readonly gradleProjectName: string;
  • Type: string

Name of the gradle project.


modelDirRequired
public readonly modelDir: string;
  • Type: string

Directory of model source code.


SmithyServiceProjectDefinition

Creates a project which defines a Smithy service, and transforms the Smithy model to OpenAPI.

Initializers

import { SmithyServiceProjectDefinition } from '@aws/pdk/type-safe-api'

new SmithyServiceProjectDefinition(project: Project, options: SmithyServiceProjectDefinitionOptions)
Name Type Description
project projen.Project No description.
options SmithyServiceProjectDefinitionOptions No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.
addDeps Add maven-style or local file dependencies to the smithy model project.
addSmithyDeps Add dependencies on other smithy models, such that their shapes can be imported in this project.
addSources Add additional paths to model source files or directories.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

addDeps
public addDeps(deps: string): void

Add maven-style or local file dependencies to the smithy model project.

depsRequired
  • Type: string

dependencies to add, eg "software.amazon.smithy:smithy-validation-model:1.27.2" or "file://../some/path/build/lib/my-shapes.jar.


addSmithyDeps
public addSmithyDeps(deps: SmithyProjectDefinition): void

Add dependencies on other smithy models, such that their shapes can be imported in this project.

depsRequired

smithy definitions to depend on.


addSources
public addSources(sources: string): void

Add additional paths to model source files or directories.

Paths should be relative to the project outdir. Any absolute paths will be resolved as relative paths.

sourcesRequired
  • Type: string

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { SmithyServiceProjectDefinition } from '@aws/pdk/type-safe-api'

SmithyServiceProjectDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { SmithyServiceProjectDefinition } from '@aws/pdk/type-safe-api'

SmithyServiceProjectDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
gradleProjectName string Name of the gradle project.
modelDir string Directory of model source code.
generatedModelDir string Directory of generated model source code.
openApiSpecificationPath string Path to the generated OpenAPI specification, relative to the project outdir.
smithyJsonModelPath string Path to the json Smithy model, relative to the project outdir.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

gradleProjectNameRequired
public readonly gradleProjectName: string;
  • Type: string

Name of the gradle project.


modelDirRequired
public readonly modelDir: string;
  • Type: string

Directory of model source code.


generatedModelDirRequired
public readonly generatedModelDir: string;
  • Type: string

Directory of generated model source code.


openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the generated OpenAPI specification, relative to the project outdir.


smithyJsonModelPathRequired
public readonly smithyJsonModelPath: string;
  • Type: string

Path to the json Smithy model, relative to the project outdir.


SmithyShapeLibraryProject

A project for defining a library of Smithy shapes which can be consumed by other projects.

Initializers

import { SmithyShapeLibraryProject } from '@aws/pdk/type-safe-api'

new SmithyShapeLibraryProject(options: SmithyShapeLibraryProjectOptions)
Name Type Description
options SmithyShapeLibraryProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addSmithyDeps Add a dependency on other smithy projects.
smithyProjectDefinition Returns the smithy project definition.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addSmithyDeps
public addSmithyDeps(deps: SmithyBaseProject): void

Add a dependency on other smithy projects.

depsRequired

smithyProjectDefinition
public smithyProjectDefinition(): SmithyProjectDefinition

Returns the smithy project definition.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { SmithyShapeLibraryProject } from '@aws/pdk/type-safe-api'

SmithyShapeLibraryProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { SmithyShapeLibraryProject } from '@aws/pdk/type-safe-api'

SmithyShapeLibraryProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { SmithyShapeLibraryProject } from '@aws/pdk/type-safe-api'

SmithyShapeLibraryProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
definition SmithyProjectDefinition Smithy model and build settings.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


definitionRequired
public readonly definition: SmithyProjectDefinition;

Smithy model and build settings.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


SnapStartFunction

A lambda function which enables SnapStart on published versions by default.

Initializers

import { SnapStartFunction } from '@aws/pdk/type-safe-api'

new SnapStartFunction(scope: Construct, id: string, props: SnapStartFunctionProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props SnapStartFunctionProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.
addEventSource Adds an event source to this function.
addEventSourceMapping Adds an event source that maps to this AWS Lambda function.
addFunctionUrl Adds a url to this lambda function.
addPermission Adds a permission to the Lambda resource policy.
addToRolePolicy Adds a statement to the IAM role assumed by the instance.
configureAsyncInvoke Configures options for asynchronous invocation.
considerWarningOnInvokeFunctionPermissions A warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction are added to the unqualified function.
grantInvoke Grant the given identity permissions to invoke this Lambda.
grantInvokeCompositePrincipal Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
grantInvokeLatestVersion Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.
grantInvokeUrl Grant the given identity permissions to invoke this Lambda Function URL.
grantInvokeVersion Grant the given identity permissions to invoke the given version of this Lambda.
metric Return the given named metric for this Function.
metricDuration How long execution of this Lambda takes.
metricErrors How many invocations of this Lambda fail.
metricInvocations How often this Lambda is invoked.
metricThrottles How often this Lambda is throttled.
addAlias Defines an alias for this function.
addEnvironment Adds an environment variable to this Lambda function.
addLayers Adds one or more Lambda Layers to this Lambda function.
invalidateVersionBasedOn Mix additional information into the hash of the Version object.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired
  • Type: aws-cdk-lib.RemovalPolicy

addEventSource
public addEventSource(source: IEventSource): void

Adds an event source to this function.

Event sources are implemented in the aws-cdk-lib/aws-lambda-event-sources module.

The following example adds an SQS Queue as an event source:

import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
myFunction.addEventSource(new SqsEventSource(myQueue));

sourceRequired
  • Type: aws-cdk-lib.aws_lambda.IEventSource

addEventSourceMapping
public addEventSourceMapping(id: string, options: EventSourceMappingOptions): EventSourceMapping

Adds an event source that maps to this AWS Lambda function.

idRequired
  • Type: string

optionsRequired
  • Type: aws-cdk-lib.aws_lambda.EventSourceMappingOptions

addFunctionUrl
public addFunctionUrl(options?: FunctionUrlOptions): FunctionUrl

Adds a url to this lambda function.

optionsOptional
  • Type: aws-cdk-lib.aws_lambda.FunctionUrlOptions

addPermission
public addPermission(id: string, permission: Permission): void

Adds a permission to the Lambda resource policy.

Permission for details.

idRequired
  • Type: string

The id for the permission construct.


permissionRequired
  • Type: aws-cdk-lib.aws_lambda.Permission

The permission to grant to this Lambda function.


addToRolePolicy
public addToRolePolicy(statement: PolicyStatement): void

Adds a statement to the IAM role assumed by the instance.

statementRequired
  • Type: aws-cdk-lib.aws_iam.PolicyStatement

configureAsyncInvoke
public configureAsyncInvoke(options: EventInvokeConfigOptions): void

Configures options for asynchronous invocation.

optionsRequired
  • Type: aws-cdk-lib.aws_lambda.EventInvokeConfigOptions

considerWarningOnInvokeFunctionPermissions
public considerWarningOnInvokeFunctionPermissions(scope: Construct, action: string): void

A warning will be added to functions under the following conditions: - permissions that include lambda:InvokeFunction are added to the unqualified function.

function.currentVersion is invoked before or after the permission is created.

This applies only to permissions on Lambda functions, not versions or aliases. This function is overridden as a noOp for QualifiedFunctionBase.

scopeRequired
  • Type: constructs.Construct

actionRequired
  • Type: string

grantInvoke
public grantInvoke(grantee: IGrantable): Grant

Grant the given identity permissions to invoke this Lambda.

granteeRequired
  • Type: aws-cdk-lib.aws_iam.IGrantable

grantInvokeCompositePrincipal
public grantInvokeCompositePrincipal(compositePrincipal: CompositePrincipal): Grant[]

Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.

compositePrincipalRequired
  • Type: aws-cdk-lib.aws_iam.CompositePrincipal

grantInvokeLatestVersion
public grantInvokeLatestVersion(grantee: IGrantable): Grant

Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.

granteeRequired
  • Type: aws-cdk-lib.aws_iam.IGrantable

grantInvokeUrl
public grantInvokeUrl(grantee: IGrantable): Grant

Grant the given identity permissions to invoke this Lambda Function URL.

granteeRequired
  • Type: aws-cdk-lib.aws_iam.IGrantable

grantInvokeVersion
public grantInvokeVersion(grantee: IGrantable, version: IVersion): Grant

Grant the given identity permissions to invoke the given version of this Lambda.

granteeRequired
  • Type: aws-cdk-lib.aws_iam.IGrantable

versionRequired
  • Type: aws-cdk-lib.aws_lambda.IVersion

metric
public metric(metricName: string, props?: MetricOptions): Metric

Return the given named metric for this Function.

metricNameRequired
  • Type: string

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricDuration
public metricDuration(props?: MetricOptions): Metric

How long execution of this Lambda takes.

Average over 5 minutes

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricErrors
public metricErrors(props?: MetricOptions): Metric

How many invocations of this Lambda fail.

Sum over 5 minutes

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricInvocations
public metricInvocations(props?: MetricOptions): Metric

How often this Lambda is invoked.

Sum over 5 minutes

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricThrottles
public metricThrottles(props?: MetricOptions): Metric

How often this Lambda is throttled.

Sum over 5 minutes

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

addAlias
public addAlias(aliasName: string, options?: AliasOptions): Alias

Defines an alias for this function.

The alias will automatically be updated to point to the latest version of the function as it is being updated during a deployment.

declare const fn: lambda.Function;

fn.addAlias('Live');

// Is equivalent to

new lambda.Alias(this, 'AliasLive', {
  aliasName: 'Live',
  version: fn.currentVersion,
});
aliasNameRequired
  • Type: string

The name of the alias.


optionsOptional
  • Type: aws-cdk-lib.aws_lambda.AliasOptions

Alias options.


addEnvironment
public addEnvironment(key: string, value: string, options?: EnvironmentOptions): Function

Adds an environment variable to this Lambda function.

If this is a ref to a Lambda function, this operation results in a no-op.

keyRequired
  • Type: string

The environment variable key.


valueRequired
  • Type: string

The environment variable's value.


optionsOptional
  • Type: aws-cdk-lib.aws_lambda.EnvironmentOptions

Environment variable options.


addLayers
public addLayers(layers: ILayerVersion): void

Adds one or more Lambda Layers to this Lambda function.

layersRequired
  • Type: aws-cdk-lib.aws_lambda.ILayerVersion

the layers to be added.


invalidateVersionBasedOn
public invalidateVersionBasedOn(x: string): void

Mix additional information into the hash of the Version object.

The Lambda Function construct does its best to automatically create a new Version when anything about the Function changes (its code, its layers, any of the other properties).

However, you can sometimes source information from places that the CDK cannot look into, like the deploy-time values of SSM parameters. In those cases, the CDK would not force the creation of a new Version object when it actually should.

This method can be used to invalidate the current Version object. Pass in any string into this method, and make sure the string changes when you know a new Version needs to be created.

This method may be called more than once.

xRequired
  • Type: string

Static Functions

Name Description
isConstruct Checks if x is a construct.
isOwnedResource Returns true if the construct was created by CDK, and false otherwise.
isResource Check whether the given construct is a Resource.
classifyVersionProperty Record whether specific properties in the AWS::Lambda::Function resource should also be associated to the Version resource.
fromFunctionArn Import a lambda function into the CDK using its ARN.
fromFunctionAttributes Creates a Lambda function object which represents a function not defined within this stack.
fromFunctionName Import a lambda function into the CDK using its name.
metricAll Return the given named metric for this Lambda.
metricAllConcurrentExecutions Metric for the number of concurrent executions across all Lambdas.
metricAllDuration Metric for the Duration executing all Lambdas.
metricAllErrors Metric for the number of Errors executing all Lambdas.
metricAllInvocations Metric for the number of invocations of all Lambdas.
metricAllThrottles Metric for the number of throttled invocations of all Lambdas.
metricAllUnreservedConcurrentExecutions Metric for the number of unreserved concurrent executions across all Lambdas.

isConstruct
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isOwnedResource
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.isOwnedResource(construct: IConstruct)

Returns true if the construct was created by CDK, and false otherwise.

constructRequired
  • Type: constructs.IConstruct

isResource
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired
  • Type: constructs.IConstruct

classifyVersionProperty
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.classifyVersionProperty(propertyName: string, locked: boolean)

Record whether specific properties in the AWS::Lambda::Function resource should also be associated to the Version resource.

See 'currentVersion' section in the module README for more details.

propertyNameRequired
  • Type: string

The property to classify.


lockedRequired
  • Type: boolean

whether the property should be associated to the version or not.


fromFunctionArn
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.fromFunctionArn(scope: Construct, id: string, functionArn: string)

Import a lambda function into the CDK using its ARN.

For Function.addPermissions() to work on this imported lambda, make sure that is in the same account and region as the stack you are importing it into.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

functionArnRequired
  • Type: string

fromFunctionAttributes
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.fromFunctionAttributes(scope: Construct, id: string, attrs: FunctionAttributes)

Creates a Lambda function object which represents a function not defined within this stack.

For Function.addPermissions() to work on this imported lambda, set the sameEnvironment property to true if this imported lambda is in the same account and region as the stack you are importing it into.

scopeRequired
  • Type: constructs.Construct

The parent construct.


idRequired
  • Type: string

The name of the lambda construct.


attrsRequired
  • Type: aws-cdk-lib.aws_lambda.FunctionAttributes

the attributes of the function to import.


fromFunctionName
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.fromFunctionName(scope: Construct, id: string, functionName: string)

Import a lambda function into the CDK using its name.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

functionNameRequired
  • Type: string

metricAll
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAll(metricName: string, props?: MetricOptions)

Return the given named metric for this Lambda.

metricNameRequired
  • Type: string

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricAllConcurrentExecutions
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAllConcurrentExecutions(props?: MetricOptions)

Metric for the number of concurrent executions across all Lambdas.

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricAllDuration
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAllDuration(props?: MetricOptions)

Metric for the Duration executing all Lambdas.

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricAllErrors
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAllErrors(props?: MetricOptions)

Metric for the number of Errors executing all Lambdas.

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricAllInvocations
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAllInvocations(props?: MetricOptions)

Metric for the number of invocations of all Lambdas.

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricAllThrottles
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAllThrottles(props?: MetricOptions)

Metric for the number of throttled invocations of all Lambdas.

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

metricAllUnreservedConcurrentExecutions
import { SnapStartFunction } from '@aws/pdk/type-safe-api'

SnapStartFunction.metricAllUnreservedConcurrentExecutions(props?: MetricOptions)

Metric for the number of unreserved concurrent executions across all Lambdas.

propsOptional
  • Type: aws-cdk-lib.aws_cloudwatch.MetricOptions

Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.
architecture aws-cdk-lib.aws_lambda.Architecture The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).
connections aws-cdk-lib.aws_ec2.Connections Access the Connections object.
functionArn string ARN of this function.
functionName string Name of this function.
grantPrincipal aws-cdk-lib.aws_iam.IPrincipal The principal this Lambda Function is running as.
isBoundToVpc boolean Whether or not this Lambda function was bound to a VPC.
latestVersion aws-cdk-lib.aws_lambda.IVersion The $LATEST version of this function.
permissionsNode constructs.Node The construct node where permissions are attached.
resourceArnsForGrantInvoke string[] The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
role aws-cdk-lib.aws_iam.IRole Execution role associated with this function.
currentVersion aws-cdk-lib.aws_lambda.Version Returns a lambda.Version which represents the current version of this Lambda function. A new version will be created every time the function's configuration changes.
logGroup aws-cdk-lib.aws_logs.ILogGroup The LogGroup where the Lambda function's logs are made available.
runtime aws-cdk-lib.aws_lambda.Runtime The runtime configured for this lambda.
deadLetterQueue aws-cdk-lib.aws_sqs.IQueue The DLQ (as queue) associated with this Lambda Function (this is an optional attribute).
deadLetterTopic aws-cdk-lib.aws_sns.ITopic The DLQ (as topic) associated with this Lambda Function (this is an optional attribute).
timeout aws-cdk-lib.Duration The timeout configured for this lambda.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


envRequired
public readonly env: ResourceEnvironment;
  • Type: aws-cdk-lib.ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;
  • Type: aws-cdk-lib.Stack

The stack in which this resource is defined.


architectureRequired
public readonly architecture: Architecture;
  • Type: aws-cdk-lib.aws_lambda.Architecture

The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).


connectionsRequired
public readonly connections: Connections;
  • Type: aws-cdk-lib.aws_ec2.Connections

Access the Connections object.

Will fail if not a VPC-enabled Lambda Function


functionArnRequired
public readonly functionArn: string;
  • Type: string

ARN of this function.


functionNameRequired
public readonly functionName: string;
  • Type: string

Name of this function.


grantPrincipalRequired
public readonly grantPrincipal: IPrincipal;
  • Type: aws-cdk-lib.aws_iam.IPrincipal

The principal this Lambda Function is running as.


isBoundToVpcRequired
public readonly isBoundToVpc: boolean;
  • Type: boolean

Whether or not this Lambda function was bound to a VPC.

If this is is false, trying to access the connections object will fail.


latestVersionRequired
public readonly latestVersion: IVersion;
  • Type: aws-cdk-lib.aws_lambda.IVersion

The $LATEST version of this function.

Note that this is reference to a non-specific AWS Lambda version, which means the function this version refers to can return different results in different invocations.

To obtain a reference to an explicit version which references the current function configuration, use lambdaFunction.currentVersion instead.


permissionsNodeRequired
public readonly permissionsNode: Node;
  • Type: constructs.Node

The construct node where permissions are attached.


resourceArnsForGrantInvokeRequired
public readonly resourceArnsForGrantInvoke: string[];
  • Type: string[]

The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().


roleOptional
public readonly role: IRole;
  • Type: aws-cdk-lib.aws_iam.IRole

Execution role associated with this function.


currentVersionRequired
public readonly currentVersion: Version;
  • Type: aws-cdk-lib.aws_lambda.Version

Returns a lambda.Version which represents the current version of this Lambda function. A new version will be created every time the function's configuration changes.

You can specify options for this version using the currentVersionOptions prop when initializing the lambda.Function.


logGroupRequired
public readonly logGroup: ILogGroup;
  • Type: aws-cdk-lib.aws_logs.ILogGroup

The LogGroup where the Lambda function's logs are made available.

If either logRetention is set or this property is called, a CloudFormation custom resource is added to the stack that pre-creates the log group as part of the stack deployment, if it already doesn't exist, and sets the correct log retention period (never expire, by default).

Further, if the log group already exists and the logRetention is not set, the custom resource will reset the log retention to never expire even if it was configured with a different value.


runtimeRequired
public readonly runtime: Runtime;
  • Type: aws-cdk-lib.aws_lambda.Runtime

The runtime configured for this lambda.


deadLetterQueueOptional
public readonly deadLetterQueue: IQueue;
  • Type: aws-cdk-lib.aws_sqs.IQueue

The DLQ (as queue) associated with this Lambda Function (this is an optional attribute).


deadLetterTopicOptional
public readonly deadLetterTopic: ITopic;
  • Type: aws-cdk-lib.aws_sns.ITopic

The DLQ (as topic) associated with this Lambda Function (this is an optional attribute).


timeoutOptional
public readonly timeout: Duration;
  • Type: aws-cdk-lib.Duration

The timeout configured for this lambda.


TypeSafeApiAsyncModelBuild

Adds a task to convert the OpenAPI specification into an AsyncAPI specification, which can be used for documentation generation.

Initializers

import { TypeSafeApiAsyncModelBuild } from '@aws/pdk/type-safe-api'

new TypeSafeApiAsyncModelBuild(project: Project, options: TypeSafeApiAsyncModelBuildOptions)
Name Type Description
project projen.Project No description.
options TypeSafeApiAsyncModelBuildOptions No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { TypeSafeApiAsyncModelBuild } from '@aws/pdk/type-safe-api'

TypeSafeApiAsyncModelBuild.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { TypeSafeApiAsyncModelBuild } from '@aws/pdk/type-safe-api'

TypeSafeApiAsyncModelBuild.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

TypeSafeApiModelBuild

Adds the build task for parsing/bundling an OpenAPI spec ready for use by code generation projects.

Initializers

import { TypeSafeApiModelBuild } from '@aws/pdk/type-safe-api'

new TypeSafeApiModelBuild(project: Project, options: TypeSafeApiModelBuildOptions)
Name Type Description
project projen.Project No description.
options TypeSafeApiModelBuildOptions No description.

projectRequired
  • Type: projen.Project

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { TypeSafeApiModelBuild } from '@aws/pdk/type-safe-api'

TypeSafeApiModelBuild.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { TypeSafeApiModelBuild } from '@aws/pdk/type-safe-api'

TypeSafeApiModelBuild.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

TypeSafeApiProject

Project for a type-safe API, defined using Smithy or OpenAPI.

Generates a CDK construct to deploy your API, as well as client and server code to help build your API quickly.

Initializers

import { TypeSafeApiProject } from '@aws/pdk/type-safe-api'

new TypeSafeApiProject(options: TypeSafeApiProjectOptions)
Name Type Description
options TypeSafeApiProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { TypeSafeApiProject } from '@aws/pdk/type-safe-api'

TypeSafeApiProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { TypeSafeApiProject } from '@aws/pdk/type-safe-api'

TypeSafeApiProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { TypeSafeApiProject } from '@aws/pdk/type-safe-api'

TypeSafeApiProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
all ProjectCollections Collections of all sub-projects managed by this project.
documentation GeneratedDocumentationProjects Generated documentation projects.
handlers GeneratedCodeProjects Lambda handlers projects.
infrastructure GeneratedCodeProjects Generated infrastructure projects.
library GeneratedLibraryProjects Generated library projects.
model ModelProject Project for the api model.
runtime GeneratedCodeProjects Generated runtime projects.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


allRequired
public readonly all: ProjectCollections;

Collections of all sub-projects managed by this project.


documentationRequired
public readonly documentation: GeneratedDocumentationProjects;

Generated documentation projects.

Only the properties corresponding to specified documentation.formats will be defined.


handlersRequired
public readonly handlers: GeneratedCodeProjects;

Lambda handlers projects.

Only the properties corresponding to handlers.languages will be defined.


infrastructureRequired
public readonly infrastructure: GeneratedCodeProjects;

Generated infrastructure projects.

Only the property corresponding to infrastructure.language will be defined.


libraryRequired
public readonly library: GeneratedLibraryProjects;

Generated library projects.

Only the properties corresponding to specified library.libraries will be defined.


modelRequired
public readonly model: ModelProject;

Project for the api model.


runtimeRequired
public readonly runtime: GeneratedCodeProjects;

Generated runtime projects.

When runtime.languages includes the corresponding language, the project can be assumed to be defined.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


TypeSafeRestApi

A construct for creating an api gateway rest api based on the definition in the OpenAPI spec.

Initializers

import { TypeSafeRestApi } from '@aws/pdk/type-safe-api'

new TypeSafeRestApi(scope: Construct, id: string, props: TypeSafeRestApiProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props TypeSafeRestApiProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { TypeSafeRestApi } from '@aws/pdk/type-safe-api'

TypeSafeRestApi.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
api aws-cdk-lib.aws_apigateway.SpecRestApi Underlying API Gateway API construct.
extendedApiSpecification any The OpenAPI specification with applied API gateway extensions.
ipSet aws-cdk-lib.aws_wafv2.CfnIPSet Reference to the IP set if created.
webAcl aws-cdk-lib.aws_wafv2.CfnWebACL Reference to the webacl, if created.
webAclAssociation aws-cdk-lib.aws_wafv2.CfnWebACLAssociation Reference to the web acl association if created.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


apiRequired
public readonly api: SpecRestApi;
  • Type: aws-cdk-lib.aws_apigateway.SpecRestApi

Underlying API Gateway API construct.


extendedApiSpecificationRequired
public readonly extendedApiSpecification: any;
  • Type: any

The OpenAPI specification with applied API gateway extensions.


ipSetOptional
public readonly ipSet: CfnIPSet;
  • Type: aws-cdk-lib.aws_wafv2.CfnIPSet

Reference to the IP set if created.


webAclOptional
public readonly webAcl: CfnWebACL;
  • Type: aws-cdk-lib.aws_wafv2.CfnWebACL

Reference to the webacl, if created.


webAclAssociationOptional
public readonly webAclAssociation: CfnWebACLAssociation;
  • Type: aws-cdk-lib.aws_wafv2.CfnWebACLAssociation

Reference to the web acl association if created.


TypeSafeWebsocketApi

A construct for creating a websocket API, based on the provided spec and integrations.

Initializers

import { TypeSafeWebsocketApi } from '@aws/pdk/type-safe-api'

new TypeSafeWebsocketApi(scope: Construct, id: string, props: TypeSafeWebsocketApiProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props TypeSafeWebsocketApiProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { TypeSafeWebsocketApi } from '@aws/pdk/type-safe-api'

TypeSafeWebsocketApi.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
api aws-cdk-lib.aws_apigatewayv2.WebSocketApi Reference to the websocket API.
defaultStage aws-cdk-lib.aws_apigatewayv2.WebSocketStage Reference to the default deploy stage.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


apiRequired
public readonly api: WebSocketApi;
  • Type: aws-cdk-lib.aws_apigatewayv2.WebSocketApi

Reference to the websocket API.


defaultStageRequired
public readonly defaultStage: WebSocketStage;
  • Type: aws-cdk-lib.aws_apigatewayv2.WebSocketStage

Reference to the default deploy stage.


TypeSafeWebSocketApiProject

Project for a Type Safe WebSocket API, defined using Smithy or OpenAPI.

Generates a CDK construct to deploy your API, as well as client and server code to help build your API quickly.

Initializers

import { TypeSafeWebSocketApiProject } from '@aws/pdk/type-safe-api'

new TypeSafeWebSocketApiProject(options: TypeSafeWebSocketApiProjectOptions)
Name Type Description
options TypeSafeWebSocketApiProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Consider a set of files as "generated".
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(_glob: string): void

Consider a set of files as "generated".

This method is implemented by derived classes and used for example, to add git attributes to tell GitHub that certain files are generated.

_globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { TypeSafeWebSocketApiProject } from '@aws/pdk/type-safe-api'

TypeSafeWebSocketApiProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { TypeSafeWebSocketApiProject } from '@aws/pdk/type-safe-api'

TypeSafeWebSocketApiProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { TypeSafeWebSocketApiProject } from '@aws/pdk/type-safe-api'

TypeSafeWebSocketApiProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
all ProjectCollections Collections of all sub-projects managed by this project.
documentation GeneratedWebSocketDocumentationProjects Generated documentation projects.
handlers GeneratedCodeProjects Lambda handlers projects.
infrastructure GeneratedCodeProjects Generated infrastructure projects.
library GeneratedWebSocketLibraryProjects Generated library projects.
model WebSocketModelProject Project for the api model.
runtime GeneratedCodeProjects Generated runtime projects.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


allRequired
public readonly all: ProjectCollections;

Collections of all sub-projects managed by this project.


documentationRequired
public readonly documentation: GeneratedWebSocketDocumentationProjects;

Generated documentation projects.

Only the properties corresponding to specified documentation.formats will be defined.


handlersRequired
public readonly handlers: GeneratedCodeProjects;

Lambda handlers projects.

Only the properties corresponding to handlers.languages will be defined.


infrastructureRequired
public readonly infrastructure: GeneratedCodeProjects;

Generated infrastructure projects.

Only the property corresponding to infrastructure.language will be defined.


libraryRequired
public readonly library: GeneratedWebSocketLibraryProjects;

Generated library projects.

Only the properties corresponding to specified library.libraries will be defined.


modelRequired
public readonly model: WebSocketModelProject;

Project for the api model.


runtimeRequired
public readonly runtime: GeneratedCodeProjects;

Generated runtime projects.

When runtime.languages includes the corresponding language, the project can be assumed to be defined.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


TypeSpecAsyncDefinition

The TypeSpec model definition for an async api.

Initializers

import { TypeSpecAsyncDefinition } from '@aws/pdk/type-safe-api'

new TypeSpecAsyncDefinition(project: NodeProject, options: TypeSpecAsyncDefinitionOptions)
Name Type Description
project projen.javascript.NodeProject No description.
options TypeSpecAsyncDefinitionOptions No description.

projectRequired
  • Type: projen.javascript.NodeProject

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { TypeSpecAsyncDefinition } from '@aws/pdk/type-safe-api'

TypeSpecAsyncDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { TypeSpecAsyncDefinition } from '@aws/pdk/type-safe-api'

TypeSpecAsyncDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
openApiSpecificationPath string Path to the generated OpenAPI specification.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the generated OpenAPI specification.


TypeSpecAsyncModelProject

Model project for defining a WebSocket API in TypeSpec.

Initializers

import { TypeSpecAsyncModelProject } from '@aws/pdk/type-safe-api'

new TypeSpecAsyncModelProject(options: TypeSpecAsyncModelProjectOptions)
Name Type Description
options TypeSpecAsyncModelProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Adds patterns to be ignored by npm.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Marks the provided file(s) as being generated.
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addBins No description.
addBundledDeps Defines bundled dependencies.
addCompileCommand DEPRECATED.
addDeps Defines normal dependencies.
addDevDeps Defines development/test dependencies.
addFields Directly set fields in package.json.
addKeywords Adds keywords to package.json (deduplicated).
addPeerDeps Defines peer dependencies.
addScripts Replaces the contents of multiple npm package.json scripts.
addTestCommand DEPRECATED.
hasScript Indicates if a script by the name name is defined.
removeScript Removes the npm script (always successful).
renderWorkflowSetup Returns the set of workflow steps which should be executed to bootstrap a workflow.
setScript Replaces the contents of an npm package.json script.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(pattern: string): void

Adds patterns to be ignored by npm.

patternRequired
  • Type: string

The pattern to ignore.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

Marks the provided file(s) as being generated.

This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

This will typically be npx projen TASK.

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addBins
public addBins(bins: {[ key: string ]: string}): void
binsRequired
  • Type: {[ key: string ]: string}

addBundledDeps
public addBundledDeps(deps: string): void

Defines bundled dependencies.

Bundled dependencies will be added as normal dependencies as well as to the bundledDependencies section of your package.json.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


~~addCompileCommand~~
public addCompileCommand(commands: string): void

DEPRECATED.

commandsRequired
  • Type: string

addDeps
public addDeps(deps: string): void

Defines normal dependencies.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addDevDeps
public addDevDeps(deps: string): void

Defines development/test dependencies.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addFields
public addFields(fields: {[ key: string ]: any}): void

Directly set fields in package.json.

fieldsRequired
  • Type: {[ key: string ]: any}

The fields to set.


addKeywords
public addKeywords(keywords: string): void

Adds keywords to package.json (deduplicated).

keywordsRequired
  • Type: string

The keywords to add.


addPeerDeps
public addPeerDeps(deps: string): void

Defines peer dependencies.

When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addScripts
public addScripts(scripts: {[ key: string ]: string}): void

Replaces the contents of multiple npm package.json scripts.

scriptsRequired
  • Type: {[ key: string ]: string}

The scripts to set.


~~addTestCommand~~
public addTestCommand(commands: string): void

DEPRECATED.

commandsRequired
  • Type: string

~~hasScript~~
public hasScript(name: string): boolean

Indicates if a script by the name name is defined.

nameRequired
  • Type: string

The name of the script.


removeScript
public removeScript(name: string): void

Removes the npm script (always successful).

nameRequired
  • Type: string

The name of the script.


renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]

Returns the set of workflow steps which should be executed to bootstrap a workflow.

optionsOptional
  • Type: projen.javascript.RenderWorkflowSetupOptions

Options.


setScript
public setScript(name: string, command: string): void

Replaces the contents of an npm package.json script.

nameRequired
  • Type: string

The script name.


commandRequired
  • Type: string

The command to execute.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { TypeSpecAsyncModelProject } from '@aws/pdk/type-safe-api'

TypeSpecAsyncModelProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { TypeSpecAsyncModelProject } from '@aws/pdk/type-safe-api'

TypeSpecAsyncModelProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { TypeSpecAsyncModelProject } from '@aws/pdk/type-safe-api'

TypeSpecAsyncModelProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
projectType projen.ProjectType No description.
autoApprove projen.github.AutoApprove Auto approve set up for this project.
devContainer projen.vscode.DevContainer Access for .devcontainer.json (used for GitHub Codespaces).
github projen.github.GitHub Access all github components.
gitpod projen.Gitpod Access for Gitpod.
vscode projen.vscode.VsCode Access all VSCode components.
allowLibraryDependencies boolean No description.
artifactsDirectory string The build output directory.
artifactsJavascriptDirectory string The location of the npm tarball after build (${artifactsDirectory}/js).
bundler projen.javascript.Bundler No description.
entrypoint string No description.
manifest any No description.
npmrc projen.javascript.NpmConfig The .npmrc file.
package projen.javascript.NodePackage API for managing the node package.
packageManager projen.javascript.NodePackageManager The package manager to use.
runScriptCommand string The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
autoMerge projen.github.AutoMerge Component that sets up mergify for merging approved pull requests.
buildWorkflow projen.build.BuildWorkflow The PR build GitHub workflow.
buildWorkflowJobId string The job ID of the build workflow.
jest projen.javascript.Jest The Jest configuration (if enabled).
maxNodeVersion string Maximum node version required by this package.
minNodeVersion string Minimum node.js version required by this package.
npmignore projen.IgnoreFile The .npmignore file.
prettier projen.javascript.Prettier No description.
publisher projen.release.Publisher Package publisher.
release projen.release.Release Release management.
upgradeWorkflow projen.javascript.UpgradeDependencies The upgrade workflow.
apiName string No description.
definition TypeSpecAsyncDefinition No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


~~allowLibraryDependencies~~Required
  • Deprecated: use package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
  • Type: boolean

artifactsDirectoryRequired
public readonly artifactsDirectory: string;
  • Type: string

The build output directory.

An npm tarball will be created under the js subdirectory. For example, if this is set to dist (the default), the npm tarball will be placed under dist/js/boom-boom-1.2.3.tg.


artifactsJavascriptDirectoryRequired
public readonly artifactsJavascriptDirectory: string;
  • Type: string

The location of the npm tarball after build (${artifactsDirectory}/js).


bundlerRequired
public readonly bundler: Bundler;
  • Type: projen.javascript.Bundler

~~entrypoint~~Required
  • Deprecated: use package.entrypoint
public readonly entrypoint: string;
  • Type: string

~~manifest~~Required
  • Deprecated: use package.addField(x, y)
public readonly manifest: any;
  • Type: any

npmrcRequired
public readonly npmrc: NpmConfig;
  • Type: projen.javascript.NpmConfig

The .npmrc file.


packageRequired
public readonly package: NodePackage;
  • Type: projen.javascript.NodePackage

API for managing the node package.


~~packageManager~~Required
  • Deprecated: use package.packageManager
public readonly packageManager: NodePackageManager;
  • Type: projen.javascript.NodePackageManager

The package manager to use.


runScriptCommandRequired
public readonly runScriptCommand: string;
  • Type: string

The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).


autoMergeOptional
public readonly autoMerge: AutoMerge;
  • Type: projen.github.AutoMerge

Component that sets up mergify for merging approved pull requests.


buildWorkflowOptional
public readonly buildWorkflow: BuildWorkflow;
  • Type: projen.build.BuildWorkflow

The PR build GitHub workflow.

undefined if buildWorkflow is disabled.


buildWorkflowJobIdOptional
public readonly buildWorkflowJobId: string;
  • Type: string

The job ID of the build workflow.


jestOptional
public readonly jest: Jest;
  • Type: projen.javascript.Jest

The Jest configuration (if enabled).


maxNodeVersionOptional
public readonly maxNodeVersion: string;
  • Type: string

Maximum node version required by this package.


minNodeVersionOptional
public readonly minNodeVersion: string;
  • Type: string

Minimum node.js version required by this package.


npmignoreOptional
public readonly npmignore: IgnoreFile;
  • Type: projen.IgnoreFile

The .npmignore file.


prettierOptional
public readonly prettier: Prettier;
  • Type: projen.javascript.Prettier

~~publisher~~Optional
  • Deprecated: use release.publisher.
public readonly publisher: Publisher;
  • Type: projen.release.Publisher

Package publisher.

This will be undefined if the project does not have a release workflow.


releaseOptional
public readonly release: Release;
  • Type: projen.release.Release

Release management.


upgradeWorkflowOptional
public readonly upgradeWorkflow: UpgradeDependencies;
  • Type: projen.javascript.UpgradeDependencies

The upgrade workflow.


apiNameRequired
public readonly apiName: string;
  • Type: string

definitionRequired
public readonly definition: TypeSpecAsyncDefinition;

Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


TypeSpecDefinition

The TypeSpec model definition.

Initializers

import { TypeSpecDefinition } from '@aws/pdk/type-safe-api'

new TypeSpecDefinition(project: NodeProject, options: TypeSpecDefinitionOptions)
Name Type Description
project projen.javascript.NodeProject No description.
options TypeSpecDefinitionOptions No description.

projectRequired
  • Type: projen.javascript.NodeProject

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { TypeSpecDefinition } from '@aws/pdk/type-safe-api'

TypeSpecDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { TypeSpecDefinition } from '@aws/pdk/type-safe-api'

TypeSpecDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
openApiSpecificationPath string Path to the generated OpenAPI specification.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the generated OpenAPI specification.


TypeSpecModelProject

Model project for defining a REST API in TypeSpec.

Initializers

import { TypeSpecModelProject } from '@aws/pdk/type-safe-api'

new TypeSpecModelProject(options: TypeSpecModelProjectOptions)
Name Type Description
options TypeSpecModelProjectOptions No description.

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Adds patterns to be ignored by npm.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Marks the provided file(s) as being generated.
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addBins No description.
addBundledDeps Defines bundled dependencies.
addCompileCommand DEPRECATED.
addDeps Defines normal dependencies.
addDevDeps Defines development/test dependencies.
addFields Directly set fields in package.json.
addKeywords Adds keywords to package.json (deduplicated).
addPeerDeps Defines peer dependencies.
addScripts Replaces the contents of multiple npm package.json scripts.
addTestCommand DEPRECATED.
hasScript Indicates if a script by the name name is defined.
removeScript Removes the npm script (always successful).
renderWorkflowSetup Returns the set of workflow steps which should be executed to bootstrap a workflow.
setScript Replaces the contents of an npm package.json script.

toString
public toString(): string

Returns a string representation of this construct.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(pattern: string): void

Adds patterns to be ignored by npm.

patternRequired
  • Type: string

The pattern to ignore.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


~~addTip~~
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

Marks the provided file(s) as being generated.

This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

This will typically be npx projen TASK.

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all subprojects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


~~tryFindJsonFile~~
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addBins
public addBins(bins: {[ key: string ]: string}): void
binsRequired
  • Type: {[ key: string ]: string}

addBundledDeps
public addBundledDeps(deps: string): void

Defines bundled dependencies.

Bundled dependencies will be added as normal dependencies as well as to the bundledDependencies section of your package.json.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


~~addCompileCommand~~
public addCompileCommand(commands: string): void

DEPRECATED.

commandsRequired
  • Type: string

addDeps
public addDeps(deps: string): void

Defines normal dependencies.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addDevDeps
public addDevDeps(deps: string): void

Defines development/test dependencies.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addFields
public addFields(fields: {[ key: string ]: any}): void

Directly set fields in package.json.

fieldsRequired
  • Type: {[ key: string ]: any}

The fields to set.


addKeywords
public addKeywords(keywords: string): void

Adds keywords to package.json (deduplicated).

keywordsRequired
  • Type: string

The keywords to add.


addPeerDeps
public addPeerDeps(deps: string): void

Defines peer dependencies.

When adding peer dependencies, a devDependency will also be added on the pinned version of the declared peer. This will ensure that you are testing your code against the minimum version required from your consumers.

depsRequired
  • Type: string

Names modules to install.

By default, the the dependency will be installed in the next npx projen run and the version will be recorded in your package.json file. You can upgrade manually or using yarn add/upgrade. If you wish to specify a version range use this syntax: module@^7.


addScripts
public addScripts(scripts: {[ key: string ]: string}): void

Replaces the contents of multiple npm package.json scripts.

scriptsRequired
  • Type: {[ key: string ]: string}

The scripts to set.


~~addTestCommand~~
public addTestCommand(commands: string): void

DEPRECATED.

commandsRequired
  • Type: string

~~hasScript~~
public hasScript(name: string): boolean

Indicates if a script by the name name is defined.

nameRequired
  • Type: string

The name of the script.


removeScript
public removeScript(name: string): void

Removes the npm script (always successful).

nameRequired
  • Type: string

The name of the script.


renderWorkflowSetup
public renderWorkflowSetup(options?: RenderWorkflowSetupOptions): JobStep[]

Returns the set of workflow steps which should be executed to bootstrap a workflow.

optionsOptional
  • Type: projen.javascript.RenderWorkflowSetupOptions

Options.


setScript
public setScript(name: string, command: string): void

Replaces the contents of an npm package.json script.

nameRequired
  • Type: string

The script name.


commandRequired
  • Type: string

The command to execute.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isProject Test whether the given construct is a project.
of Find the closest ancestor project for given construct.

isConstruct
import { TypeSpecModelProject } from '@aws/pdk/type-safe-api'

TypeSpecModelProject.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isProject
import { TypeSpecModelProject } from '@aws/pdk/type-safe-api'

TypeSpecModelProject.isProject(x: any)

Test whether the given construct is a project.

xRequired
  • Type: any

of
import { TypeSpecModelProject } from '@aws/pdk/type-safe-api'

TypeSpecModelProject.of(construct: IConstruct)

Find the closest ancestor project for given construct.

When given a project, this it the project itself.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
projectType projen.ProjectType No description.
autoApprove projen.github.AutoApprove Auto approve set up for this project.
devContainer projen.vscode.DevContainer Access for .devcontainer.json (used for GitHub Codespaces).
github projen.github.GitHub Access all github components.
gitpod projen.Gitpod Access for Gitpod.
vscode projen.vscode.VsCode Access all VSCode components.
allowLibraryDependencies boolean No description.
artifactsDirectory string The build output directory.
artifactsJavascriptDirectory string The location of the npm tarball after build (${artifactsDirectory}/js).
bundler projen.javascript.Bundler No description.
entrypoint string No description.
manifest any No description.
npmrc projen.javascript.NpmConfig The .npmrc file.
package projen.javascript.NodePackage API for managing the node package.
packageManager projen.javascript.NodePackageManager The package manager to use.
runScriptCommand string The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).
autoMerge projen.github.AutoMerge Component that sets up mergify for merging approved pull requests.
buildWorkflow projen.build.BuildWorkflow The PR build GitHub workflow.
buildWorkflowJobId string The job ID of the build workflow.
jest projen.javascript.Jest The Jest configuration (if enabled).
maxNodeVersion string Maximum node version required by this package.
minNodeVersion string Minimum node.js version required by this package.
npmignore projen.IgnoreFile The .npmignore file.
prettier projen.javascript.Prettier No description.
publisher projen.release.Publisher Package publisher.
release projen.release.Release Release management.
upgradeWorkflow projen.javascript.UpgradeDependencies The upgrade workflow.
apiName string No description.
definition TypeSpecDefinition No description.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


~~allowLibraryDependencies~~Required
  • Deprecated: use package.allowLibraryDependencies
public readonly allowLibraryDependencies: boolean;
  • Type: boolean

artifactsDirectoryRequired
public readonly artifactsDirectory: string;
  • Type: string

The build output directory.

An npm tarball will be created under the js subdirectory. For example, if this is set to dist (the default), the npm tarball will be placed under dist/js/boom-boom-1.2.3.tg.


artifactsJavascriptDirectoryRequired
public readonly artifactsJavascriptDirectory: string;
  • Type: string

The location of the npm tarball after build (${artifactsDirectory}/js).


bundlerRequired
public readonly bundler: Bundler;
  • Type: projen.javascript.Bundler

~~entrypoint~~Required
  • Deprecated: use package.entrypoint
public readonly entrypoint: string;
  • Type: string

~~manifest~~Required
  • Deprecated: use package.addField(x, y)
public readonly manifest: any;
  • Type: any

npmrcRequired
public readonly npmrc: NpmConfig;
  • Type: projen.javascript.NpmConfig

The .npmrc file.


packageRequired
public readonly package: NodePackage;
  • Type: projen.javascript.NodePackage

API for managing the node package.


~~packageManager~~Required
  • Deprecated: use package.packageManager
public readonly packageManager: NodePackageManager;
  • Type: projen.javascript.NodePackageManager

The package manager to use.


runScriptCommandRequired
public readonly runScriptCommand: string;
  • Type: string

The command to use to run scripts (e.g. yarn run or npm run depends on the package manager).


autoMergeOptional
public readonly autoMerge: AutoMerge;
  • Type: projen.github.AutoMerge

Component that sets up mergify for merging approved pull requests.


buildWorkflowOptional
public readonly buildWorkflow: BuildWorkflow;
  • Type: projen.build.BuildWorkflow

The PR build GitHub workflow.

undefined if buildWorkflow is disabled.


buildWorkflowJobIdOptional
public readonly buildWorkflowJobId: string;
  • Type: string

The job ID of the build workflow.


jestOptional
public readonly jest: Jest;
  • Type: projen.javascript.Jest

The Jest configuration (if enabled).


maxNodeVersionOptional
public readonly maxNodeVersion: string;
  • Type: string

Maximum node version required by this package.


minNodeVersionOptional
public readonly minNodeVersion: string;
  • Type: string

Minimum node.js version required by this package.


npmignoreOptional
public readonly npmignore: IgnoreFile;
  • Type: projen.IgnoreFile

The .npmignore file.


prettierOptional
public readonly prettier: Prettier;
  • Type: projen.javascript.Prettier

~~publisher~~Optional
  • Deprecated: use release.publisher.
public readonly publisher: Publisher;
  • Type: projen.release.Publisher

Package publisher.

This will be undefined if the project does not have a release workflow.


releaseOptional
public readonly release: Release;
  • Type: projen.release.Release

Release management.


upgradeWorkflowOptional
public readonly upgradeWorkflow: UpgradeDependencies;
  • Type: projen.javascript.UpgradeDependencies

The upgrade workflow.


apiNameRequired
public readonly apiName: string;
  • Type: string

definitionRequired
public readonly definition: TypeSpecDefinition;

Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


TypeSpecProjectDefinition

Creates a project which allows APIs to be defined in TypeSpec.

https://typespec.io/

Initializers

import { TypeSpecProjectDefinition } from '@aws/pdk/type-safe-api'

new TypeSpecProjectDefinition(project: NodeProject, options: TypeSpecProjectDefinitionOptions)
Name Type Description
project projen.javascript.NodeProject No description.
options TypeSpecProjectDefinitionOptions No description.

projectRequired
  • Type: projen.javascript.NodeProject

optionsRequired

Methods

Name Description
toString Returns a string representation of this construct.
postSynthesize Called after synthesis.
preSynthesize Called before synthesis.
synthesize Synthesizes files to the project output directory.

toString
public toString(): string

Returns a string representation of this construct.

postSynthesize
public postSynthesize(): void

Called after synthesis.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before synthesis.

synthesize
public synthesize(): void

Synthesizes files to the project output directory.

Static Functions

Name Description
isConstruct Checks if x is a construct.
isComponent Test whether the given construct is a component.

isConstruct
import { TypeSpecProjectDefinition } from '@aws/pdk/type-safe-api'

TypeSpecProjectDefinition.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


isComponent
import { TypeSpecProjectDefinition } from '@aws/pdk/type-safe-api'

TypeSpecProjectDefinition.isComponent(x: any)

Test whether the given construct is a component.

xRequired
  • Type: any

Properties

Name Type Description
node constructs.Node The tree node.
project projen.Project No description.
openApiSpecificationPath string Path to the generated OpenAPI specification.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


projectRequired
public readonly project: Project;
  • Type: projen.Project

openApiSpecificationPathRequired
public readonly openApiSpecificationPath: string;
  • Type: string

Path to the generated OpenAPI specification.


Structs

ApiGatewayIntegration

Represents an api gateway integration.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-integration.html

Initializer

import { ApiGatewayIntegration } from '@aws/pdk/type-safe-api'

const apiGatewayIntegration: ApiGatewayIntegration = { ... }

Properties

Name Type Description
cacheKeyParameters string[] A list of request parameters whose values are to be cached.
cacheNamespace string An API-specific tag group of related cached parameters.
connectionId string The ID of a VpcLink for the private integration.
connectionType string The integration connection type.
contentHandling string Request payload encoding conversion types.
credentials string For AWS IAM role-based credentials, specify the ARN of an appropriate IAM role.
httpMethod string The HTTP method used in the integration request.
passthroughBehavior string Specifies how a request payload of unmapped content type is passed through the integration request without modification.
requestParameters {[ key: string ]: string} Specifies mappings from method request parameters to integration request parameters.
requestTemplates {[ key: string ]: string} Mapping templates for a request payload of specified MIME types.
responses {[ key: string ]: ApiGatewayIntegrationResponse} Defines the method's responses and specifies desired parameter mappings or payload mappings from integration responses to method responses.
timeoutInMillis number Custom timeout between 50 and 29,000 milliseconds.
tlsConfig ApiGatewayIntegrationTlsConfig Specifies the TLS configuration for an integration.
type string The type of integration with the specified backend.
uri string The endpoint URI of the backend.

cacheKeyParametersOptional
public readonly cacheKeyParameters: string[];
  • Type: string[]

A list of request parameters whose values are to be cached.


cacheNamespaceOptional
public readonly cacheNamespace: string;
  • Type: string

An API-specific tag group of related cached parameters.


connectionIdOptional
public readonly connectionId: string;
  • Type: string

The ID of a VpcLink for the private integration.

https://docs.aws.amazon.com/apigateway/latest/api/API_VpcLink.html


connectionTypeOptional
public readonly connectionType: string;
  • Type: string

The integration connection type.

The valid value is "VPC_LINK" for private integration or "INTERNET", otherwise.


contentHandlingOptional
public readonly contentHandling: string;
  • Type: string

Request payload encoding conversion types.

Valid values are 1) CONVERT_TO_TEXT, for converting a binary payload into a base64-encoded string or converting a text payload into a utf-8-encoded string or passing through the text payload natively without modification, and 2) CONVERT_TO_BINARY, for converting a text payload into a base64-decoded blob or passing through a binary payload natively without modification.


credentialsOptional
public readonly credentials: string;
  • Type: string

For AWS IAM role-based credentials, specify the ARN of an appropriate IAM role.

If unspecified, credentials default to resource-based permissions that must be added manually to allow the API to access the resource. For more information, see Granting Permissions Using a Resource Policy.

Note: When using IAM credentials, make sure that AWS STS Regional endpoints are enabled for the Region where this API is deployed for best performance.


httpMethodOptional
public readonly httpMethod: string;
  • Type: string

The HTTP method used in the integration request.

For Lambda function invocations, the value must be POST.


passthroughBehaviorOptional
public readonly passthroughBehavior: string;
  • Type: string

Specifies how a request payload of unmapped content type is passed through the integration request without modification.

Supported values are when_no_templates, when_no_match, and never.

https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html#passthroughBehavior


requestParametersOptional
public readonly requestParameters: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Specifies mappings from method request parameters to integration request parameters.

Supported request parameters are querystring, path, header, and body.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-integration-requestParameters.html


requestTemplatesOptional
public readonly requestTemplates: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Mapping templates for a request payload of specified MIME types.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-integration-requestTemplates.html


responsesOptional
public readonly responses: {[ key: string ]: ApiGatewayIntegrationResponse};

Defines the method's responses and specifies desired parameter mappings or payload mappings from integration responses to method responses.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-integration-responses.html


timeoutInMillisOptional
public readonly timeoutInMillis: number;
  • Type: number

Custom timeout between 50 and 29,000 milliseconds.

The default value is 29,000 milliseconds or 29 seconds.


tlsConfigOptional
public readonly tlsConfig: ApiGatewayIntegrationTlsConfig;

Specifies the TLS configuration for an integration.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-extensions-integration-tls-config.html


typeOptional
public readonly type: string;
  • Type: string

The type of integration with the specified backend.

https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html#type


uriOptional
public readonly uri: string;
  • Type: string

The endpoint URI of the backend.

For integrations of the aws type, this is an ARN value. For the HTTP integration, this is the URL of the HTTP endpoint including the https or http scheme.


ApiGatewayIntegrationResponse

API Gateway integration response.

https://docs.aws.amazon.com/apigateway/latest/api/API_Integration.html

Initializer

import { ApiGatewayIntegrationResponse } from '@aws/pdk/type-safe-api'

const apiGatewayIntegrationResponse: ApiGatewayIntegrationResponse = { ... }

Properties

Name Type Description
responseParameters {[ key: string ]: string} Specifies parameter mappings for the response.
responseTemplates {[ key: string ]: string} Specifies MIME type-specific mapping templates for the response’s payload.
statusCode string HTTP status code for the method response.
contentHandling string Response payload encoding conversion types.

responseParametersRequired
public readonly responseParameters: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Specifies parameter mappings for the response.


responseTemplatesRequired
public readonly responseTemplates: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

Specifies MIME type-specific mapping templates for the response’s payload.


statusCodeRequired
public readonly statusCode: string;
  • Type: string

HTTP status code for the method response.


contentHandlingOptional
public readonly contentHandling: string;
  • Type: string

Response payload encoding conversion types.

Valid values are 1) CONVERT_TO_TEXT, for converting a binary payload into a base64-encoded string or converting a text payload into a utf-8-encoded string or passing through the text payload natively without modification, and 2) CONVERT_TO_BINARY, for converting a text payload into a base64-decoded blob or passing through a binary payload natively without modification.


ApiGatewayIntegrationTlsConfig

Specifies the TLS configuration for an integration.

https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-extensions-integration-tls-config.html

Initializer

import { ApiGatewayIntegrationTlsConfig } from '@aws/pdk/type-safe-api'

const apiGatewayIntegrationTlsConfig: ApiGatewayIntegrationTlsConfig = { ... }

Properties

Name Type Description
insecureSkipVerification boolean Specifies whether or not API Gateway skips verification that the certificate for an integration endpoint is issued by a supported certificate authority.

insecureSkipVerificationOptional
public readonly insecureSkipVerification: boolean;
  • Type: boolean

Specifies whether or not API Gateway skips verification that the certificate for an integration endpoint is issued by a supported certificate authority.

This isn’t recommended, but it enables you to use certificates that are signed by private certificate authorities, or certificates that are self-signed. If enabled, API Gateway still performs basic certificate validation, which includes checking the certificate's expiration date, hostname, and presence of a root certificate authority. Supported only for HTTP and HTTP_PROXY integrations.


ApiKeyOptions

Options for API keys.

Initializer

import { ApiKeyOptions } from '@aws/pdk/type-safe-api'

const apiKeyOptions: ApiKeyOptions = { ... }

Properties

Name Type Description
source aws-cdk-lib.aws_apigateway.ApiKeySourceType Source type for an API key.
requiredByDefault boolean Set to true to require an API key on all operations by default.

sourceRequired
public readonly source: ApiKeySourceType;
  • Type: aws-cdk-lib.aws_apigateway.ApiKeySourceType

Source type for an API key.


requiredByDefaultOptional
public readonly requiredByDefault: boolean;
  • Type: boolean

Set to true to require an API key on all operations by default.

Only applicable when the source is HEADER.


AuthorizerProps

Properties for an authorizer.

Initializer

import { AuthorizerProps } from '@aws/pdk/type-safe-api'

const authorizerProps: AuthorizerProps = { ... }

Properties

Name Type Description
authorizationType aws-cdk-lib.aws_apigateway.AuthorizationType The type of the authorizer.
authorizerId string The unique identifier for the authorizer.
authorizationScopes string[] Scopes for the authorizer, if any.

authorizationTypeRequired
public readonly authorizationType: AuthorizationType;
  • Type: aws-cdk-lib.aws_apigateway.AuthorizationType

The type of the authorizer.


authorizerIdRequired
public readonly authorizerId: string;
  • Type: string

The unique identifier for the authorizer.


authorizationScopesOptional
public readonly authorizationScopes: string[];
  • Type: string[]

Scopes for the authorizer, if any.


CidrAllowList

Representation of a CIDR range.

Initializer

import { CidrAllowList } from '@aws/pdk/type-safe-api'

const cidrAllowList: CidrAllowList = { ... }

Properties

Name Type Description
cidrRanges string[] Specify an IPv4 address by using CIDR notation.
cidrType string Type of CIDR range.

cidrRangesRequired
public readonly cidrRanges: string[];
  • Type: string[]

Specify an IPv4 address by using CIDR notation.

For example: To configure AWS WAF to allow, block, or count requests that originated from the IP address 192.0.2.44, specify 192.0.2.44/32 . To configure AWS WAF to allow, block, or count requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify 192.0.2.0/24 .

For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .

Specify an IPv6 address by using CIDR notation. For example: To configure AWS WAF to allow, block, or count requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify 1111:0000:0000:0000:0000:0000:0000:0111/128 . To configure AWS WAF to allow, block, or count requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify 1111:0000:0000:0000:0000:0000:0000:0000/64 .


cidrTypeRequired
public readonly cidrType: string;
  • Type: string

Type of CIDR range.


CodeGenerationSourceOptions

Options for the source files used for code generation.

Initializer

import { CodeGenerationSourceOptions } from '@aws/pdk/type-safe-api'

const codeGenerationSourceOptions: CodeGenerationSourceOptions = { ... }

Properties

Name Type Description
specPath string Path to the OpenAPI specification.

specPathRequired
public readonly specPath: string;
  • Type: string

Path to the OpenAPI specification.


CognitoAuthorizerProps

Properties used to configure a cognito authorizer.

Initializer

import { CognitoAuthorizerProps } from '@aws/pdk/type-safe-api'

const cognitoAuthorizerProps: CognitoAuthorizerProps = { ... }

Properties

Name Type Description
authorizerId string Unique identifier for this authorizer.
userPools aws-cdk-lib.aws_cognito.IUserPool[] The Cognito user pools associated with this authorizer.
authorizationScopes string[] A list of authorization scopes configured on the method.

authorizerIdRequired
public readonly authorizerId: string;
  • Type: string

Unique identifier for this authorizer.


userPoolsRequired
public readonly userPools: IUserPool[];
  • Type: aws-cdk-lib.aws_cognito.IUserPool[]

The Cognito user pools associated with this authorizer.


authorizationScopesOptional
public readonly authorizationScopes: string[];
  • Type: string[]
  • Default: []

A list of authorization scopes configured on the method.

When used as the default authorizer, these scopes will be applied to all methods without an authorizer at the integration level.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html#cfn-apigateway-method-authorizationscopes


CustomAuthorizerProps

Properties used to configure a custom authorizer.

Initializer

import { CustomAuthorizerProps } from '@aws/pdk/type-safe-api'

const customAuthorizerProps: CustomAuthorizerProps = { ... }

Properties

Name Type Description
authorizerId string Unique identifier for this authorizer.
function aws-cdk-lib.aws_lambda.IFunction The lambda function used to authorize requests.
authorizerResultTtlInSeconds number The number of seconds during which the authorizer result is cached.
identitySource string The source of the identity in an incoming request.
type CustomAuthorizerType The type of custom authorizer.

authorizerIdRequired
public readonly authorizerId: string;
  • Type: string

Unique identifier for this authorizer.


functionRequired
public readonly function: IFunction;
  • Type: aws-cdk-lib.aws_lambda.IFunction

The lambda function used to authorize requests.


authorizerResultTtlInSecondsOptional
public readonly authorizerResultTtlInSeconds: number;
  • Type: number
  • Default: 300

The number of seconds during which the authorizer result is cached.


identitySourceOptional
public readonly identitySource: string;
  • Type: string
  • Default: "method.request.header.Authorization"

The source of the identity in an incoming request.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-identitysource


typeOptional
public readonly type: CustomAuthorizerType;

The type of custom authorizer.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-authorizer.html#cfn-apigateway-authorizer-type


CustomIntegrationResponseSetProps

Properties for a custom integration response set.

Initializer

import { CustomIntegrationResponseSetProps } from '@aws/pdk/type-safe-api'

const customIntegrationResponseSetProps: CustomIntegrationResponseSetProps = { ... }

Properties

Name Type Description
responses {[ key: string ]: ApiGatewayIntegrationResponse} The responses to add to the integration response.

responsesOptional
public readonly responses: {[ key: string ]: ApiGatewayIntegrationResponse};

The responses to add to the integration response.


DefaultPassthroughIntegrationResponseSetProps

Options for the DefaultPassthroughIntegrationResponseSet.

Initializer

import { DefaultPassthroughIntegrationResponseSetProps } from '@aws/pdk/type-safe-api'

const defaultPassthroughIntegrationResponseSetProps: DefaultPassthroughIntegrationResponseSetProps = { ... }

Properties

Name Type Description
statusCode number Override the status code returned by the default integration response.

statusCodeOptional
public readonly statusCode: number;
  • Type: number
  • Default: 200

Override the status code returned by the default integration response.


DocumentationConfiguration

Configuration for generated documentation.

Initializer

import { DocumentationConfiguration } from '@aws/pdk/type-safe-api'

const documentationConfiguration: DocumentationConfiguration = { ... }

Properties

Name Type Description
formats DocumentationFormat[] Formats for generated documentation.
options GeneratedDocumentationOptions Options for the generated documentation projects.

formatsRequired
public readonly formats: DocumentationFormat[];

Formats for generated documentation.


optionsOptional
public readonly options: GeneratedDocumentationOptions;

Options for the generated documentation projects.

Note that only those provided for the specified formats will apply


GeneratedAsyncApiHtmlDocumentationOptions

Options for the async api html documentation project.

Initializer

import { GeneratedAsyncApiHtmlDocumentationOptions } from '@aws/pdk/type-safe-api'

const generatedAsyncApiHtmlDocumentationOptions: GeneratedAsyncApiHtmlDocumentationOptions = { ... }

Properties

Name Type Description
commitGeneratedCode boolean Whether to commit the code generated by the OpenAPI Generator.

commitGeneratedCodeOptional
public readonly commitGeneratedCode: boolean;
  • Type: boolean
  • Default: false

Whether to commit the code generated by the OpenAPI Generator.


GeneratedAsyncApiMarkdownDocumentationOptions

Options for the async api markdown documentation project.

Initializer

import { GeneratedAsyncApiMarkdownDocumentationOptions } from '@aws/pdk/type-safe-api'

const generatedAsyncApiMarkdownDocumentationOptions: GeneratedAsyncApiMarkdownDocumentationOptions = { ... }

Properties

Name Type Description
commitGeneratedCode boolean Whether to commit the code generated by the OpenAPI Generator.

commitGeneratedCodeOptional
public readonly commitGeneratedCode: boolean;
  • Type: boolean
  • Default: false

Whether to commit the code generated by the OpenAPI Generator.


GeneratedCodeProjects

Generated code projects.

Initializer

import { GeneratedCodeProjects } from '@aws/pdk/type-safe-api'

const generatedCodeProjects: GeneratedCodeProjects = { ... }

Properties

Name Type Description
java projen.java.JavaProject Generated java project.
python projen.python.PythonProject Generated python project.
typescript projen.typescript.TypeScriptProject Generated typescript project.

javaOptional
public readonly java: JavaProject;
  • Type: projen.java.JavaProject

Generated java project.


pythonOptional
public readonly python: PythonProject;
  • Type: projen.python.PythonProject

Generated python project.


typescriptOptional
public readonly typescript: TypeScriptProject;
  • Type: projen.typescript.TypeScriptProject

Generated typescript project.


GeneratedDocumentationOptions

Options for generated documentation projects.

Initializer

import { GeneratedDocumentationOptions } from '@aws/pdk/type-safe-api'

const generatedDocumentationOptions: GeneratedDocumentationOptions = { ... }

Properties

Name Type Description
htmlRedoc GeneratedHtmlRedocDocumentationOptions Generated html redoc documentation project options.
markdown GeneratedMarkdownDocumentationOptions Generated markdown documentation project options.
plantuml GeneratedPlantumlDocumentationOptions Generated plantuml documentation project options.

htmlRedocOptional
public readonly htmlRedoc: GeneratedHtmlRedocDocumentationOptions;

Generated html redoc documentation project options.


markdownOptional
public readonly markdown: GeneratedMarkdownDocumentationOptions;

Generated markdown documentation project options.


plantumlOptional
public readonly plantuml: GeneratedPlantumlDocumentationOptions;

Generated plantuml documentation project options.


GeneratedDocumentationProjects

Generated documentation project references.

Initializer

import { GeneratedDocumentationProjects } from '@aws/pdk/type-safe-api'

const generatedDocumentationProjects: GeneratedDocumentationProjects = { ... }

Properties

Name Type Description
htmlRedoc projen.Project Generated html redoc documentation project.
markdown projen.Project Generated markdown documentation project.
plantuml projen.Project Generated plantuml documentation project.

htmlRedocOptional
public readonly htmlRedoc: Project;
  • Type: projen.Project

Generated html redoc documentation project.


markdownOptional
public readonly markdown: Project;
  • Type: projen.Project

Generated markdown documentation project.


plantumlOptional
public readonly plantuml: Project;
  • Type: projen.Project

Generated plantuml documentation project.


GeneratedHandlersCodeOptions

Options for lambda handler projects for implementing API operations.

Initializer

import { GeneratedHandlersCodeOptions } from '@aws/pdk/type-safe-api'

const generatedHandlersCodeOptions: GeneratedHandlersCodeOptions = { ... }

Properties

Name Type Description
java GeneratedJavaHandlersOptions Options for the java handlers project.
python GeneratedPythonHandlersOptions Options for the python handlers project.
typescript GeneratedTypeScriptHandlersOptions Options for the typescript handlers project.

javaOptional
public readonly java: GeneratedJavaHandlersOptions;

Options for the java handlers project.

These override the default inferred options.


pythonOptional
public readonly python: GeneratedPythonHandlersOptions;

Options for the python handlers project.

These override the default inferred options.


typescriptOptional
public readonly typescript: GeneratedTypeScriptHandlersOptions;

Options for the typescript handlers project.

These override the default inferred options.


GeneratedHtml2DocumentationOptions

Options for the html2 documentation project.

Initializer

import { GeneratedHtml2DocumentationOptions } from '@aws/pdk/type-safe-api'

const generatedHtml2DocumentationOptions: GeneratedHtml2DocumentationOptions = { ... }

Properties

Name Type Description
commitGeneratedCode boolean Whether to commit the code generated by the OpenAPI Generator.

commitGeneratedCodeOptional
public readonly commitGeneratedCode: boolean;
  • Type: boolean
  • Default: false

Whether to commit the code generated by the OpenAPI Generator.


GeneratedHtmlRedocDocumentationOptions

Options for the html redoc documentation project.

Initializer

import { GeneratedHtmlRedocDocumentationOptions } from '@aws/pdk/type-safe-api'

const generatedHtmlRedocDocumentationOptions: GeneratedHtmlRedocDocumentationOptions = { ... }

Properties

Name Type Description
commitGeneratedCode boolean Whether to commit the code generated by the OpenAPI Generator.

commitGeneratedCodeOptional
public readonly commitGeneratedCode: boolean;
  • Type: boolean
  • Default: false

Whether to commit the code generated by the OpenAPI Generator.


GeneratedInfrastructureCodeOptions

Options for generated infrastructure.

Initializer

import { GeneratedInfrastructureCodeOptions } from '@aws/pdk/type-safe-api'

const generatedInfrastructureCodeOptions: GeneratedInfrastructureCodeOptions = { ... }

Properties

Name Type Description
java GeneratedJavaInfrastructureOptions Options for the generated java infrastructure project.
python GeneratedPythonInfrastructureOptions Options for the generated python infrastructure project.
typescript GeneratedTypeScriptInfrastructureOptions Options for the generated typescript infrastructure project.

javaOptional
public readonly java: GeneratedJavaInfrastructureOptions;

Options for the generated java infrastructure project.

These override the default inferred options.


pythonOptional
public readonly python: GeneratedPythonInfrastructureOptions;

Options for the generated python infrastructure project.

These override the default inferred options.


typescriptOptional
public readonly typescript: GeneratedTypeScriptInfrastructureOptions;

Options for the generated typescript infrastructure project.

These override the default inferred options.


GeneratedJavaHandlersOptions

Options for configuring a generated java handlers project.

Initializer

import { GeneratedJavaHandlersOptions } from '@aws/pdk/type-safe-api'

const generatedJavaHandlersOptions: GeneratedJavaHandlersOptions = { ... }

Properties

Name Type Description
artifactId string The artifactId is generally the name that the project is known by.
autoApproveOptions projen.github.AutoApproveOptions Enable and configure the 'auto approve' workflow.
autoMerge boolean Enable automatic merging on GitHub.
autoMergeOptions projen.github.AutoMergeOptions Configure options for automatic merging on GitHub.
clobber boolean Add a clobber task which resets the repo to origin.
commitGenerated boolean Whether to commit the managed files by default.
compileOptions projen.java.MavenCompileOptions Compile options.
deps string[] List of runtime dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.
description string Description of a project is always good.
devContainer boolean Add a VSCode development environment (used for GitHub Codespaces).
distdir string Final artifact output directory.
github boolean Enable GitHub integration.
githubOptions projen.github.GitHubOptions Options for GitHub integration.
gitIgnoreOptions projen.IgnoreFileOptions Configuration options for .gitignore file.
gitOptions projen.GitOptions Configuration options for git.
gitpod boolean Add a Gitpod development environment.
groupId string This is generally unique amongst an organization or a project.
junit boolean Include junit tests.
junitOptions projen.java.JunitOptions junit options.
logging projen.LoggerOptions Configure logging options such as verbosity.
mergify boolean Whether mergify should be enabled on this repository or not.
mergifyOptions projen.github.MergifyOptions Options for mergify.
name string This is the name of your project.
outdir string The root directory of the project. Relative to this directory, all files are synthesized.
packaging string Project packaging format.
packagingOptions projen.java.MavenPackagingOptions Packaging options.
parent projen.Project The parent project, if this project is part of a bigger project.
parentPom projen.java.ParentPom A Parent Pom can be used to have a child project inherit properties/plugins/ect in order to reduce duplication and keep standards across a large amount of repos.
projectType projen.ProjectType Which type of project this is (library/app).
projenCommand string The shell command to use in order to run the projen CLI.
projenCredentials projen.github.GithubCredentials Choose a method of providing GitHub API access for projen workflows.
projenrcJava boolean Use projenrc in java.
projenrcJavaOptions projen.java.ProjenrcOptions Options related to projenrc in java.
projenrcJson boolean Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptions projen.ProjenrcJsonOptions Options for .projenrc.json.
projenTokenSecret string The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
readme projen.SampleReadmeProps The README setup.
renovatebot boolean Use renovatebot to handle dependency upgrades.
renovatebotOptions projen.RenovatebotOptions Options for renovatebot.
sample boolean Include sample code and test if the relevant directories don't exist.
sampleJavaPackage string The java package to use for the code sample.
stale boolean Auto-close of stale issues and pull request.
staleOptions projen.github.StaleOptions Auto-close stale issues and pull requests.
testDeps string[] List of test dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.
url string The URL, like the name, is not required.
version string This is the last piece of the naming puzzle.
vscode boolean Enable VSCode integration.
commitGeneratedCode boolean Whether to commit the code generated by the OpenAPI Generator.
runtimeVersion JavaVersion Runtime version to target for the handlers.

artifactIdOptional
public readonly artifactId: string;
  • Type: string
  • Default: "my-app"

The artifactId is generally the name that the project is known by.

Although the groupId is important, people within the group will rarely mention the groupId in discussion (they are often all be the same ID, such as the MojoHaus project groupId: org.codehaus.mojo). It, along with the groupId, creates a key that separates this project from every other project in the world (at least, it should :) ). Along with the groupId, the artifactId fully defines the artifact's living quarters within the repository. In the case of the above project, my-project lives in $M2_REPO/org/codehaus/mojo/my-project.


autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
  • Type: projen.github.AutoApproveOptions
  • Default: auto approve is disabled

Enable and configure the 'auto approve' workflow.


autoMergeOptional
public readonly autoMerge: boolean;
  • Type: boolean
  • Default: true

Enable automatic merging on GitHub.

Has no effect if github.mergify is set to false.


autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
  • Type: projen.github.AutoMergeOptions
  • Default: see defaults in AutoMergeOptions

Configure options for automatic merging on GitHub.

Has no effect if github.mergify or autoMerge is set to false.


clobberOptional
public readonly clobber: boolean;
  • Type: boolean
  • Default: true, but false for subprojects

Add a clobber task which resets the repo to origin.


commitGeneratedOptional
public readonly commitGenerated: boolean;
  • Type: boolean
  • Default: true

Whether to commit the managed files by default.


compileOptionsOptional
public readonly compileOptions: MavenCompileOptions;
  • Type: projen.java.MavenCompileOptions
  • Default: defaults

Compile options.


depsOptional
public readonly deps: string[];
  • Type: string[]
  • Default: []

List of runtime dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.

Additional dependencies can be added via project.addDependency().


descriptionOptional
public readonly description: string;
  • Type: string
  • Default: undefined

Description of a project is always good.

Although this should not replace formal documentation, a quick comment to any readers of the POM is always helpful.


devContainerOptional
public readonly devContainer: boolean;
  • Type: boolean
  • Default: false

Add a VSCode development environment (used for GitHub Codespaces).


distdirOptional
public readonly distdir: string;
  • Type: string
  • Default: "dist/java"

Final artifact output directory.


githubOptional
public readonly github: boolean;
  • Type: boolean
  • Default: true

Enable GitHub integration.

Enabled by default for root projects. Disabled for non-root projects.


githubOptionsOptional
public readonly githubOptions: GitHubOptions;
  • Type: projen.github.GitHubOptions
  • Default: see GitHubOptions

Options for GitHub integration.


gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
  • Type: projen.IgnoreFileOptions

Configuration options for .gitignore file.


gitOptionsOptional
public readonly gitOptions: GitOptions;
  • Type: projen.GitOptions

Configuration options for git.


gitpodOptional
public readonly gitpod: boolean;
  • Type: boolean
  • Default: false

Add a Gitpod development environment.


groupIdOptional
public readonly groupId: string;
  • Type: string
  • Default: "org.acme"

This is generally unique amongst an organization or a project.

For example, all core Maven artifacts do (well, should) live under the groupId org.apache.maven. Group ID's do not necessarily use the dot notation, for example, the junit project. Note that the dot-notated groupId does not have to correspond to the package structure that the project contains. It is, however, a good practice to follow. When stored within a repository, the group acts much like the Java packaging structure does in an operating system. The dots are replaced by OS specific directory separators (such as '/' in Unix) which becomes a relative directory structure from the base repository. In the example given, the org.codehaus.mojo group lives within the directory $M2_REPO/org/codehaus/mojo.


junitOptional
public readonly junit: boolean;
  • Type: boolean
  • Default: true

Include junit tests.


junitOptionsOptional
public readonly junitOptions: JunitOptions;
  • Type: projen.java.JunitOptions
  • Default: defaults

junit options.


loggingOptional
public readonly logging: LoggerOptions;
  • Type: projen.LoggerOptions
  • Default: {}

Configure logging options such as verbosity.


~~mergify~~Optional
  • Deprecated: use githubOptions.mergify instead
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


~~mergifyOptions~~Optional
  • Deprecated: use githubOptions.mergifyOptions instead
public readonly mergifyOptions: MergifyOptions;
  • Type: projen.github.MergifyOptions
  • Default: default options

Options for mergify.


nameOptional
public readonly name: string;
  • Type: string
  • Default: $BASEDIR

This is the name of your project.


outdirOptional
public readonly outdir: string;
  • Type: string
  • Default: "."

The root directory of the project. Relative to this directory, all files are synthesized.

If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other subprojects.


packagingOptional
public readonly packaging: string;
  • Type: string
  • Default: "jar"

Project packaging format.


packagingOptionsOptional
public readonly packagingOptions: MavenPackagingOptions;
  • Type: projen.java.MavenPackagingOptions
  • Default: defaults

Packaging options.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

The parent project, if this project is part of a bigger project.


parentPomOptional
public readonly parentPom: ParentPom;
  • Type: projen.java.ParentPom
  • Default: undefined

A Parent Pom can be used to have a child project inherit properties/plugins/ect in order to reduce duplication and keep standards across a large amount of repos.


~~projectType~~Optional
  • Deprecated: no longer supported at the base project level
public readonly projectType: ProjectType;
  • Type: projen.ProjectType
  • Default: ProjectType.UNKNOWN

Which type of project this is (library/app).


projenCommandOptional
public readonly projenCommand: string;
  • Type: string
  • Default: "npx projen"

The shell command to use in order to run the projen CLI.

Can be used to customize in special environments.


projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
  • Type: projen.github.GithubCredentials
  • Default: use a personal access token named PROJEN_GITHUB_TOKEN

Choose a method of providing GitHub API access for projen workflows.


projenrcJavaOptional
public readonly projenrcJava: boolean;
  • Type: boolean
  • Default: true

Use projenrc in java.

This will install projen as a java dependency and will add a synth task which will compile & execute main() from src/main/java/projenrc.java.


projenrcJavaOptionsOptional
public readonly projenrcJavaOptions: ProjenrcOptions;
  • Type: projen.java.ProjenrcOptions
  • Default: default options

Options related to projenrc in java.


projenrcJsonOptional
public readonly projenrcJson: boolean;
  • Type: boolean
  • Default: false

Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.


projenrcJsonOptionsOptional
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
  • Type: projen.ProjenrcJsonOptions
  • Default: default options

Options for .projenrc.json.


~~projenTokenSecret~~Optional
  • Deprecated: use projenCredentials
public readonly projenTokenSecret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.

This token needs to have the repo, workflows and packages scope.


readmeOptional
public readonly readme: SampleReadmeProps;
  • Type: projen.SampleReadmeProps
  • Default: { filename: 'README.md', contents: '# replace this' }

The README setup.


renovatebotOptional
public readonly renovatebot: boolean;
  • Type: boolean
  • Default: false

Use renovatebot to handle dependency upgrades.


renovatebotOptionsOptional
public readonly renovatebotOptions: RenovatebotOptions;
  • Type: projen.RenovatebotOptions
  • Default: default options

Options for renovatebot.


sampleOptional
public readonly sample: boolean;
  • Type: boolean
  • Default: true

Include sample code and test if the relevant directories don't exist.


sampleJavaPackageOptional
public readonly sampleJavaPackage: string;
  • Type: string
  • Default: "org.acme"

The java package to use for the code sample.


staleOptional
public readonly stale: boolean;
  • Type: boolean
  • Default: false

Auto-close of stale issues and pull request.

See staleOptions for options.


staleOptionsOptional
public readonly staleOptions: StaleOptions;
  • Type: projen.github.StaleOptions
  • Default: see defaults in StaleOptions

Auto-close stale issues and pull requests.

To disable set stale to false.


testDepsOptional
public readonly testDeps: string[];
  • Type: string[]
  • Default: []

List of test dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.

Additional dependencies can be added via project.addTestDependency().


urlOptional
public readonly url: string;
  • Type: string
  • Default: undefined

The URL, like the name, is not required.

This is a nice gesture for projects users, however, so that they know where the project lives.


versionOptional
public readonly version: string;
  • Type: string
  • Default: "0.1.0"

This is the last piece of the naming puzzle.

groupId:artifactId denotes a single project but they cannot delineate which incarnation of that project we are talking about. Do we want the junit:junit of 2018 (version 4.12), or of 2007 (version 3.8.2)? In short: code changes, those changes should be versioned, and this element keeps those versions in line. It is also used within an artifact's repository to separate versions from each other. my-project version 1.0 files live in the directory structure $M2_REPO/org/codehaus/mojo/my-project/1.0.


vscodeOptional
public readonly vscode: boolean;
  • Type: boolean
  • Default: true

Enable VSCode integration.

Enabled by default for root projects. Disabled for non-root projects.


commitGeneratedCodeOptional
public readonly commitGeneratedCode: boolean;
  • Type: boolean
  • Default: false

Whether to commit the code generated by the OpenAPI Generator.


runtimeVersionOptional
public readonly runtimeVersion: JavaVersion;

Runtime version to target for the handlers.


GeneratedJavaInfrastructureOptions

Options for configuring a generated java infrastructure project.

Initializer

import { GeneratedJavaInfrastructureOptions } from '@aws/pdk/type-safe-api'

const generatedJavaInfrastructureOptions: GeneratedJavaInfrastructureOptions = { ... }

Properties

Name Type Description
artifactId string The artifactId is generally the name that the project is known by.
autoApproveOptions projen.github.AutoApproveOptions Enable and configure the 'auto approve' workflow.
autoMerge boolean Enable automatic merging on GitHub.
autoMergeOptions projen.github.AutoMergeOptions Configure options for automatic merging on GitHub.
clobber boolean Add a clobber task which resets the repo to origin.
commitGenerated boolean Whether to commit the managed files by default.
compileOptions projen.java.MavenCompileOptions Compile options.
deps string[] List of runtime dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.
description string Description of a project is always good.
devContainer boolean Add a VSCode development environment (used for GitHub Codespaces).
distdir string Final artifact output directory.
github boolean Enable GitHub integration.
githubOptions projen.github.GitHubOptions Options for GitHub integration.
gitIgnoreOptions projen.IgnoreFileOptions Configuration options for .gitignore file.
gitOptions projen.GitOptions Configuration options for git.
gitpod boolean Add a Gitpod development environment.
groupId string This is generally unique amongst an organization or a project.
junit boolean Include junit tests.
junitOptions projen.java.JunitOptions junit options.
logging projen.LoggerOptions Configure logging options such as verbosity.
mergify boolean Whether mergify should be enabled on this repository or not.
mergifyOptions projen.github.MergifyOptions Options for mergify.
name string This is the name of your project.
outdir string The root directory of the project. Relative to this directory, all files are synthesized.
packaging string Project packaging format.
packagingOptions projen.java.MavenPackagingOptions Packaging options.
parent projen.Project The parent project, if this project is part of a bigger project.
parentPom projen.java.ParentPom A Parent Pom can be used to have a child project inherit properties/plugins/ect in order to reduce duplication and keep standards across a large amount of repos.
projectType projen.ProjectType Which type of project this is (library/app).
projenCommand string The shell command to use in order to run the projen CLI.
projenCredentials projen.github.GithubCredentials Choose a method of providing GitHub API access for projen workflows.
projenrcJava boolean Use projenrc in java.
projenrcJavaOptions projen.java.ProjenrcOptions Options related to projenrc in java.
projenrcJson boolean Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptions projen.ProjenrcJsonOptions Options for .projenrc.json.
projenTokenSecret string The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
readme projen.SampleReadmeProps The README setup.
renovatebot boolean Use renovatebot to handle dependency upgrades.
renovatebotOptions projen.RenovatebotOptions Options for renovatebot.
sample boolean Include sample code and test if the relevant directories don't exist.
sampleJavaPackage string The java package to use for the code sample.
stale boolean Auto-close of stale issues and pull request.
staleOptions projen.github.StaleOptions Auto-close stale issues and pull requests.
testDeps string[] List of test dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.
url string The URL, like the name, is not required.
version string This is the last piece of the naming puzzle.
vscode boolean Enable VSCode integration.
commitGeneratedCode boolean Whether to commit the code generated by the OpenAPI Generator.
mockDataOptions MockResponseDataGenerationOptions Options for the generated mock response data.

artifactIdOptional
public readonly artifactId: string;
  • Type: string
  • Default: "my-app"

The artifactId is generally the name that the project is known by.

Although the groupId is important, people within the group will rarely mention the groupId in discussion (they are often all be the same ID, such as the MojoHaus project groupId: org.codehaus.mojo). It, along with the groupId, creates a key that separates this project from every other project in the world (at least, it should :) ). Along with the groupId, the artifactId fully defines the artifact's living quarters within the repository. In the case of the above project, my-project lives in $M2_REPO/org/codehaus/mojo/my-project.


autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
  • Type: projen.github.AutoApproveOptions
  • Default: auto approve is disabled

Enable and configure the 'auto approve' workflow.


autoMergeOptional
public readonly autoMerge: boolean;
  • Type: boolean
  • Default: true

Enable automatic merging on GitHub.

Has no effect if github.mergify is set to false.


autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
  • Type: projen.github.AutoMergeOptions
  • Default: see defaults in AutoMergeOptions

Configure options for automatic merging on GitHub.

Has no effect if github.mergify or autoMerge is set to false.


clobberOptional
public readonly clobber: boolean;
  • Type: boolean
  • Default: true, but false for subprojects

Add a clobber task which resets the repo to origin.


commitGeneratedOptional
public readonly commitGenerated: boolean;
  • Type: boolean
  • Default: true

Whether to commit the managed files by default.


compileOptionsOptional
public readonly compileOptions: MavenCompileOptions;
  • Type: projen.java.MavenCompileOptions
  • Default: defaults

Compile options.


depsOptional
public readonly deps: string[];
  • Type: string[]
  • Default: []

List of runtime dependencies for this project. Dependencies use the format: <groupId>/<artifactId>@<semver>.

Additional dependencies can be added via project.addDependency().


descriptionOptional
public readonly description: string;
  • Type: string
  • Default: undefined

Description of a project is always good.

Although this should not replace formal documentation, a quick comment to any readers of the POM is always helpful.


devContainerOptional
public readonly devContainer: boolean;
  • Type: boolean
  • Default: false

Add a VSCode development environment (used for GitHub Codespaces).


distdirOptional
public readonly distdir: string;
  • Type: string
  • Default: "dist/java"

Final artifact output directory.


githubOptional
public readonly github: boolean;
  • Type: boolean
  • Default: true

Enable GitHub integration.

Enabled by default for root projects. Disabled for non-root projects.


githubOptionsOptional
public readonly githubOptions: GitHubOptions;
  • Type: projen.github.GitHubOptions
  • Default: see GitHubOptions

Options for GitHub integration.


gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
  • Type: projen.IgnoreFileOptions

Configuration options for .gitignore file.


gitOptionsOptional
public readonly gitOptions: GitOptions;
  • Type: projen.GitOptions

Configuration options for git.


gitpodOptional
public readonly gitpod: boolean;
  • Type: boolean
  • Default: false

Add a Gitpod development environment.


groupIdOptional
public readonly groupId: string;
  • Type: string
  • Default: "org.acme"

This is generally unique amongst an organization or a project.

For example, all core Maven artifacts do (well, should) live under the groupId org.apache.maven. Group ID's do not necessarily use the dot notation, for example, the junit project. Note that the dot-notated groupId does not have to correspond to the package structure that the project contains. It is, however, a good practice to follow. When stored within a repository, the group acts much like the Java packaging structure does in an operating system. The dots are replaced by OS specific directory separators (such as '/' in Unix) which becomes a relative directory structure from the base repository. In the example given, the org.codehaus.mojo group lives within the directory $M2_REPO/org/codehaus/mojo.


junitOptional
public readonly junit: boolean;
  • Type: boolean
  • Default: true

Include junit tests.


junitOptionsOptional
public readonly junitOptions: JunitOptions;
  • Type: projen.java.JunitOptions
  • Default: defaults

junit options.


loggingOptional
public readonly logging: LoggerOptions;
  • Type: projen.LoggerOptions
  • Default: {}

Configure logging options such as verbosity.


~~mergify~~Optional
  • Deprecated: use githubOptions.mergify instead
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


~~mergifyOptions~~Optional
  • Deprecated: use githubOptions.mergifyOptions instead
public readonly mergifyOptions: MergifyOptions;
  • Type: projen.github.MergifyOptions
  • Default: default options

Options for mergify.


nameOptional
public readonly name: string;
  • Type: string
  • Default: $BASEDIR

This is the name of your project.


outdirOptional
public readonly outdir: string;
  • Type: string
  • Default: "."

The root directory of the project. Relative to this directory, all files are synthesized.

If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other subprojects.


packagingOptional
public readonly packaging: string;
  • Type: string
  • Default: "jar"

Project packaging format.


packagingOptionsOptional
public readonly packagingOptions: MavenPackagingOptions;
  • Type: projen.java.MavenPackagingOptions
  • Default: defaults

Packaging options.


parentOptional