API Reference
Constructs
OpenApiAsyncDefinition
The OpenAPI Spec.
Initializers
import software.aws.pdk.type_safe_api.OpenApiAsyncDefinition;
OpenApiAsyncDefinition.Builder.create(Project project)
.openApiOptions(OpenApiModelOptions)
// .handlerLanguages(java.util.List<Language>)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
openApiOptions |
OpenApiModelOptions |
Options for the openapi model. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
project
Required
- Type: io.github.cdklabs.projen.Project
openApiOptions
Required
- Type: OpenApiModelOptions
Options for the openapi model.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.OpenApiAsyncDefinition;
OpenApiAsyncDefinition.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.OpenApiAsyncDefinition;
OpenApiAsyncDefinition.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
openApiSpecificationPath |
java.lang.String |
Path to the root OpenAPI specification file. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
openApiSpecificationPath
Required
public java.lang.String getOpenApiSpecificationPath();
- Type: java.lang.String
Path to the root OpenAPI specification file.
OpenApiAsyncModelProject
Project for defining an OpenAPI model for a WebSocket API.
Initializers
import software.aws.pdk.type_safe_api.OpenApiAsyncModelProject;
OpenApiAsyncModelProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.openApiOptions(OpenApiModelOptions)
// .handlerLanguages(java.util.List<Language>)
.parsedSpecFile(java.lang.String)
.asyncApiSpecFile(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
openApiOptions |
OpenApiModelOptions |
Options for the openapi model. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
asyncApiSpecFile |
java.lang.String |
Path to the generated AsyncAPI specification (relative to the project root). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
openApiOptions
Required
- Type: OpenApiModelOptions
Options for the openapi model.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
asyncApiSpecFile
Required
- Type: java.lang.String
Path to the generated AsyncAPI specification (relative to the project root).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.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 software.aws.pdk.type_safe_api.OpenApiAsyncModelProject;
OpenApiAsyncModelProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.OpenApiAsyncModelProject;
OpenApiAsyncModelProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.OpenApiAsyncModelProject;
OpenApiAsyncModelProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
apiName |
java.lang.String |
Name of the API. |
definition |
OpenApiAsyncDefinition |
OpenAPI specification component. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
apiName
Required
public java.lang.String getApiName();
- Type: java.lang.String
Name of the API.
definition
Required
public OpenApiAsyncDefinition getDefinition();
- Type: OpenApiAsyncDefinition
OpenAPI specification component.
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.OpenApiDefinition;
OpenApiDefinition.Builder.create(Project project)
.openApiOptions(OpenApiModelOptions)
// .handlerLanguages(java.util.List<Language>)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
openApiOptions |
OpenApiModelOptions |
Options for the openapi model. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
project
Required
- Type: io.github.cdklabs.projen.Project
openApiOptions
Required
- Type: OpenApiModelOptions
Options for the openapi model.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.OpenApiDefinition;
OpenApiDefinition.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.OpenApiDefinition;
OpenApiDefinition.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
openApiSpecificationPath |
java.lang.String |
Path to the root OpenAPI specification file. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
openApiSpecificationPath
Required
public java.lang.String getOpenApiSpecificationPath();
- Type: java.lang.String
Path to the root OpenAPI specification file.
OpenApiModelProject
Project for defining an OpenAPI model for a REST API.
Initializers
import software.aws.pdk.type_safe_api.OpenApiModelProject;
OpenApiModelProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.openApiOptions(OpenApiModelOptions)
// .handlerLanguages(java.util.List<Language>)
.parsedSpecFile(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
openApiOptions |
OpenApiModelOptions |
Options for the openapi model. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
openApiOptions
Required
- Type: OpenApiModelOptions
Options for the openapi model.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.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 software.aws.pdk.type_safe_api.OpenApiModelProject;
OpenApiModelProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.OpenApiModelProject;
OpenApiModelProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.OpenApiModelProject;
OpenApiModelProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
apiName |
java.lang.String |
Name of the API. |
definition |
OpenApiDefinition |
OpenAPI specification component. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
apiName
Required
public java.lang.String getApiName();
- Type: java.lang.String
Name of the API.
definition
Required
public OpenApiDefinition getDefinition();
- Type: OpenApiDefinition
OpenAPI specification component.
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.OpenApiProjectDefinition;
OpenApiProjectDefinition.Builder.create(Project project)
.openApiOptions(OpenApiModelOptions)
// .handlerLanguages(java.util.List<Language>)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
openApiOptions |
OpenApiModelOptions |
Options for the openapi model. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
project
Required
- Type: io.github.cdklabs.projen.Project
openApiOptions
Required
- Type: OpenApiModelOptions
Options for the openapi model.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.OpenApiProjectDefinition;
OpenApiProjectDefinition.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.OpenApiProjectDefinition;
OpenApiProjectDefinition.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
openApiSpecificationPath |
java.lang.String |
Path to the root OpenAPI specification file. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
openApiSpecificationPath
Required
public java.lang.String getOpenApiSpecificationPath();
- Type: java.lang.String
Path to the root OpenAPI specification file.
SmithyAsyncModelProject
Smithy model project for a WebSocket API.
Initializers
import software.aws.pdk.type_safe_api.SmithyAsyncModelProject;
SmithyAsyncModelProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.smithyOptions(SmithyModelOptions)
// .handlerLanguages(java.util.List<Language>)
.parsedSpecFile(java.lang.String)
.asyncApiSpecFile(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
smithyOptions |
SmithyModelOptions |
Smithy engine options. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
asyncApiSpecFile |
java.lang.String |
Path to the generated AsyncAPI specification (relative to the project root). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
smithyOptions
Required
- Type: SmithyModelOptions
Smithy engine options.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
asyncApiSpecFile
Required
- Type: java.lang.String
Path to the generated AsyncAPI specification (relative to the project root).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
addSmithyDeps
public void addSmithyDeps(SmithyBaseProject deps)
Add a dependency on other smithy projects.
deps
Required
- Type: SmithyBaseProject
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 software.aws.pdk.type_safe_api.SmithyAsyncModelProject;
SmithyAsyncModelProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.SmithyAsyncModelProject;
SmithyAsyncModelProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.SmithyAsyncModelProject;
SmithyAsyncModelProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
apiName |
java.lang.String |
Name of the API. |
definition |
SmithyServiceProjectDefinition |
Smithy model and build settings. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
apiName
Required
public java.lang.String getApiName();
- Type: java.lang.String
Name of the API.
definition
Required
public SmithyServiceProjectDefinition getDefinition();
Smithy model and build settings.
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.SmithyBaseProject;
SmithyBaseProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
addSmithyDeps
public void addSmithyDeps(SmithyBaseProject deps)
Add a dependency on other smithy projects.
deps
Required
- Type: SmithyBaseProject
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 software.aws.pdk.type_safe_api.SmithyBaseProject;
SmithyBaseProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.SmithyBaseProject;
SmithyBaseProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.SmithyBaseProject;
SmithyBaseProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.SmithyModelProject;
SmithyModelProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.smithyOptions(SmithyModelOptions)
// .handlerLanguages(java.util.List<Language>)
.parsedSpecFile(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
smithyOptions |
SmithyModelOptions |
Smithy engine options. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
smithyOptions
Required
- Type: SmithyModelOptions
Smithy engine options.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
addSmithyDeps
public void addSmithyDeps(SmithyBaseProject deps)
Add a dependency on other smithy projects.
deps
Required
- Type: SmithyBaseProject
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 software.aws.pdk.type_safe_api.SmithyModelProject;
SmithyModelProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.SmithyModelProject;
SmithyModelProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.SmithyModelProject;
SmithyModelProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
apiName |
java.lang.String |
Name of the API. |
definition |
SmithyServiceProjectDefinition |
Smithy model and build settings. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
apiName
Required
public java.lang.String getApiName();
- Type: java.lang.String
Name of the API.
definition
Required
public SmithyServiceProjectDefinition getDefinition();
Smithy model and build settings.
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.SmithyProjectDefinition;
SmithyProjectDefinition.Builder.create(Project project)
// .ignoreGradleWrapper(java.lang.Boolean)
// .ignoreSmithyBuildOutput(java.lang.Boolean)
// .smithyBuildOptions(SmithyBuildOptions)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
ignoreGradleWrapper |
java.lang.Boolean |
Set to false if you would like to check in your gradle wrapper. |
ignoreSmithyBuildOutput |
java.lang.Boolean |
Set to false if you would like to check in your smithy build output or have more fine-grained control over what is checked in, eg if you add other projections to the smithy-build.json file. |
smithyBuildOptions |
SmithyBuildOptions |
Smithy build options. |
project
Required
- Type: io.github.cdklabs.projen.Project
ignoreGradleWrapper
Optional
- Type: java.lang.Boolean
- Default: true
Set to false if you would like to check in your gradle wrapper.
Do so if you would like to use a different version of gradle to the one provided by default
ignoreSmithyBuildOutput
Optional
- Type: java.lang.Boolean
- Default: true
Set to false if you would like to check in your smithy build output or have more fine-grained control over what is checked in, eg if you add other projections to the smithy-build.json file.
smithyBuildOptions
Optional
- Type: SmithyBuildOptions
Smithy build options.
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
Synthesizes files to the project output directory.
addDeps
public void addDeps(java.lang.String deps)
Add maven-style or local file dependencies to the smithy model project.
deps
Required
- Type: java.lang.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 void addSmithyDeps(SmithyProjectDefinition deps)
Add dependencies on other smithy models, such that their shapes can be imported in this project.
deps
Required
- Type: SmithyProjectDefinition
smithy definitions to depend on.
addSources
public void addSources(java.lang.String sources)
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.
sources
Required
- Type: java.lang.String
Static Functions
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import software.aws.pdk.type_safe_api.SmithyProjectDefinition;
SmithyProjectDefinition.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.SmithyProjectDefinition;
SmithyProjectDefinition.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
gradleProjectName |
java.lang.String |
Name of the gradle project. |
modelDir |
java.lang.String |
Directory of model source code. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
gradleProjectName
Required
public java.lang.String getGradleProjectName();
- Type: java.lang.String
Name of the gradle project.
modelDir
Required
public java.lang.String getModelDir();
- Type: java.lang.String
Directory of model source code.
SmithyServiceProjectDefinition
Creates a project which defines a Smithy service, and transforms the Smithy model to OpenAPI.
Initializers
import software.aws.pdk.type_safe_api.SmithyServiceProjectDefinition;
SmithyServiceProjectDefinition.Builder.create(Project project)
.smithyOptions(SmithyModelOptions)
// .handlerLanguages(java.util.List<Language>)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
smithyOptions |
SmithyModelOptions |
Smithy engine options. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
project
Required
- Type: io.github.cdklabs.projen.Project
smithyOptions
Required
- Type: SmithyModelOptions
Smithy engine options.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
Synthesizes files to the project output directory.
addDeps
public void addDeps(java.lang.String deps)
Add maven-style or local file dependencies to the smithy model project.
deps
Required
- Type: java.lang.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 void addSmithyDeps(SmithyProjectDefinition deps)
Add dependencies on other smithy models, such that their shapes can be imported in this project.
deps
Required
- Type: SmithyProjectDefinition
smithy definitions to depend on.
addSources
public void addSources(java.lang.String sources)
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.
sources
Required
- Type: java.lang.String
Static Functions
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isComponent |
Test whether the given construct is a component. |
isConstruct
import software.aws.pdk.type_safe_api.SmithyServiceProjectDefinition;
SmithyServiceProjectDefinition.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.SmithyServiceProjectDefinition;
SmithyServiceProjectDefinition.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
gradleProjectName |
java.lang.String |
Name of the gradle project. |
modelDir |
java.lang.String |
Directory of model source code. |
generatedModelDir |
java.lang.String |
Directory of generated model source code. |
openApiSpecificationPath |
java.lang.String |
Path to the generated OpenAPI specification, relative to the project outdir. |
smithyJsonModelPath |
java.lang.String |
Path to the json Smithy model, relative to the project outdir. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
gradleProjectName
Required
public java.lang.String getGradleProjectName();
- Type: java.lang.String
Name of the gradle project.
modelDir
Required
public java.lang.String getModelDir();
- Type: java.lang.String
Directory of model source code.
generatedModelDir
Required
public java.lang.String getGeneratedModelDir();
- Type: java.lang.String
Directory of generated model source code.
openApiSpecificationPath
Required
public java.lang.String getOpenApiSpecificationPath();
- Type: java.lang.String
Path to the generated OpenAPI specification, relative to the project outdir.
smithyJsonModelPath
Required
public java.lang.String getSmithyJsonModelPath();
- Type: java.lang.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 software.aws.pdk.type_safe_api.SmithyShapeLibraryProject;
SmithyShapeLibraryProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
// .ignoreGradleWrapper(java.lang.Boolean)
// .ignoreSmithyBuildOutput(java.lang.Boolean)
// .smithyBuildOptions(SmithyBuildOptions)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
ignoreGradleWrapper |
java.lang.Boolean |
Set to false if you would like to check in your gradle wrapper. |
ignoreSmithyBuildOutput |
java.lang.Boolean |
Set to false if you would like to check in your smithy build output or have more fine-grained control over what is checked in, eg if you add other projections to the smithy-build.json file. |
smithyBuildOptions |
SmithyBuildOptions |
Smithy build options. |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
ignoreGradleWrapper
Optional
- Type: java.lang.Boolean
- Default: true
Set to false if you would like to check in your gradle wrapper.
Do so if you would like to use a different version of gradle to the one provided by default
ignoreSmithyBuildOutput
Optional
- Type: java.lang.Boolean
- Default: true
Set to false if you would like to check in your smithy build output or have more fine-grained control over what is checked in, eg if you add other projections to the smithy-build.json file.
smithyBuildOptions
Optional
- Type: SmithyBuildOptions
Smithy build options.
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
addSmithyDeps
public void addSmithyDeps(SmithyBaseProject deps)
Add a dependency on other smithy projects.
deps
Required
- Type: SmithyBaseProject
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 software.aws.pdk.type_safe_api.SmithyShapeLibraryProject;
SmithyShapeLibraryProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.SmithyShapeLibraryProject;
SmithyShapeLibraryProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.SmithyShapeLibraryProject;
SmithyShapeLibraryProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
definition |
SmithyProjectDefinition |
Smithy model and build settings. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
definition
Required
public SmithyProjectDefinition getDefinition();
- Type: SmithyProjectDefinition
Smithy model and build settings.
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.Builder.create(Construct scope, java.lang.String id)
// .maxEventAge(Duration)
// .onFailure(IDestination)
// .onSuccess(IDestination)
// .retryAttempts(java.lang.Number)
// .adotInstrumentation(AdotInstrumentationConfig)
// .allowAllIpv6Outbound(java.lang.Boolean)
// .allowAllOutbound(java.lang.Boolean)
// .allowPublicSubnet(java.lang.Boolean)
// .applicationLogLevel(java.lang.String)
// .applicationLogLevelV2(ApplicationLogLevel)
// .architecture(Architecture)
// .codeSigningConfig(ICodeSigningConfig)
// .currentVersionOptions(VersionOptions)
// .deadLetterQueue(IQueue)
// .deadLetterQueueEnabled(java.lang.Boolean)
// .deadLetterTopic(ITopic)
// .description(java.lang.String)
// .environment(java.util.Map<java.lang.String, java.lang.String>)
// .environmentEncryption(IKey)
// .ephemeralStorageSize(Size)
// .events(java.util.List<IEventSource>)
// .filesystem(FileSystem)
// .functionName(java.lang.String)
// .initialPolicy(java.util.List<PolicyStatement>)
// .insightsVersion(LambdaInsightsVersion)
// .ipv6AllowedForDualStack(java.lang.Boolean)
// .layers(java.util.List<ILayerVersion>)
// .logFormat(java.lang.String)
// .loggingFormat(LoggingFormat)
// .logGroup(ILogGroup)
// .logRetention(RetentionDays)
// .logRetentionRetryOptions(LogRetentionRetryOptions)
// .logRetentionRole(IRole)
// .memorySize(java.lang.Number)
// .paramsAndSecrets(ParamsAndSecretsLayerVersion)
// .profiling(java.lang.Boolean)
// .profilingGroup(IProfilingGroup)
// .recursiveLoop(RecursiveLoop)
// .reservedConcurrentExecutions(java.lang.Number)
// .role(IRole)
// .runtimeManagementMode(RuntimeManagementMode)
// .securityGroups(java.util.List<ISecurityGroup>)
// .snapStart(SnapStartConf)
// .systemLogLevel(java.lang.String)
// .systemLogLevelV2(SystemLogLevel)
// .timeout(Duration)
// .tracing(Tracing)
// .vpc(IVpc)
// .vpcSubnets(SubnetSelection)
.code(Code)
.handler(java.lang.String)
.runtime(Runtime)
// .disableSnapStart(java.lang.Boolean)
.build();
Name | Type | Description |
---|---|---|
scope |
software.constructs.Construct |
No description. |
id |
java.lang.String |
No description. |
maxEventAge |
software.amazon.awscdk.Duration |
The maximum age of a request that Lambda sends to a function for processing. |
onFailure |
software.amazon.awscdk.services.lambda.IDestination |
The destination for failed invocations. |
onSuccess |
software.amazon.awscdk.services.lambda.IDestination |
The destination for successful invocations. |
retryAttempts |
java.lang.Number |
The maximum number of times to retry when the function returns an error. |
adotInstrumentation |
software.amazon.awscdk.services.lambda.AdotInstrumentationConfig |
Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation. |
allowAllIpv6Outbound |
java.lang.Boolean |
Whether to allow the Lambda to send all ipv6 network traffic. |
allowAllOutbound |
java.lang.Boolean |
Whether to allow the Lambda to send all network traffic (except ipv6). |
allowPublicSubnet |
java.lang.Boolean |
Lambda Functions in a public subnet can NOT access the internet. |
applicationLogLevel |
java.lang.String |
Sets the application log level for the function. |
applicationLogLevelV2 |
software.amazon.awscdk.services.lambda.ApplicationLogLevel |
Sets the application log level for the function. |
architecture |
software.amazon.awscdk.services.lambda.Architecture |
The system architectures compatible with this lambda function. |
codeSigningConfig |
software.amazon.awscdk.services.lambda.ICodeSigningConfig |
Code signing config associated with this function. |
currentVersionOptions |
software.amazon.awscdk.services.lambda.VersionOptions |
Options for the lambda.Version resource automatically created by the fn.currentVersion method. |
deadLetterQueue |
software.amazon.awscdk.services.sqs.IQueue |
The SQS queue to use if DLQ is enabled. |
deadLetterQueueEnabled |
java.lang.Boolean |
Enabled DLQ. |
deadLetterTopic |
software.amazon.awscdk.services.sns.ITopic |
The SNS topic to use as a DLQ. |
description |
java.lang.String |
A description of the function. |
environment |
java.util.Map |
Key-value pairs that Lambda caches and makes available for your Lambda functions. |
environmentEncryption |
software.amazon.awscdk.services.kms.IKey |
The AWS KMS key that's used to encrypt your function's environment variables. |
ephemeralStorageSize |
software.amazon.awscdk.Size |
The size of the function’s /tmp directory in MiB. |
events |
java.util.List |
Event sources for this function. |
filesystem |
software.amazon.awscdk.services.lambda.FileSystem |
The filesystem configuration for the lambda function. |
functionName |
java.lang.String |
A name for the function. |
initialPolicy |
java.util.List |
Initial policy statements to add to the created Lambda Role. |
insightsVersion |
software.amazon.awscdk.services.lambda.LambdaInsightsVersion |
Specify the version of CloudWatch Lambda insights to use for monitoring. |
ipv6AllowedForDualStack |
java.lang.Boolean |
Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets. |
layers |
java.util.List |
A list of layers to add to the function's execution environment. |
logFormat |
java.lang.String |
Sets the logFormat for the function. |
loggingFormat |
software.amazon.awscdk.services.lambda.LoggingFormat |
Sets the loggingFormat for the function. |
logGroup |
software.amazon.awscdk.services.logs.ILogGroup |
The log group the function sends logs to. |
logRetention |
software.amazon.awscdk.services.logs.RetentionDays |
The number of days log events are kept in CloudWatch Logs. |
logRetentionRetryOptions |
software.amazon.awscdk.services.lambda.LogRetentionRetryOptions |
When log retention is specified, a custom resource attempts to create the CloudWatch log group. |
logRetentionRole |
software.amazon.awscdk.services.iam.IRole |
The IAM role for the Lambda function associated with the custom resource that sets the retention policy. |
memorySize |
java.lang.Number |
The amount of memory, in MB, that is allocated to your Lambda function. |
paramsAndSecrets |
software.amazon.awscdk.services.lambda.ParamsAndSecretsLayerVersion |
Specify the configuration of Parameters and Secrets Extension. |
profiling |
java.lang.Boolean |
Enable profiling. |
profilingGroup |
software.amazon.awscdk.services.codeguruprofiler.IProfilingGroup |
Profiling Group. |
recursiveLoop |
software.amazon.awscdk.services.lambda.RecursiveLoop |
Sets the Recursive Loop Protection for Lambda Function. |
reservedConcurrentExecutions |
java.lang.Number |
The maximum of concurrent executions you want to reserve for the function. |
role |
software.amazon.awscdk.services.iam.IRole |
Lambda execution role. |
runtimeManagementMode |
software.amazon.awscdk.services.lambda.RuntimeManagementMode |
Sets the runtime management configuration for a function's version. |
securityGroups |
java.util.List |
The list of security groups to associate with the Lambda's network interfaces. |
snapStart |
software.amazon.awscdk.services.lambda.SnapStartConf |
Enable SnapStart for Lambda Function. |
systemLogLevel |
java.lang.String |
Sets the system log level for the function. |
systemLogLevelV2 |
software.amazon.awscdk.services.lambda.SystemLogLevel |
Sets the system log level for the function. |
timeout |
software.amazon.awscdk.Duration |
The function execution time (in seconds) after which Lambda terminates the function. |
tracing |
software.amazon.awscdk.services.lambda.Tracing |
Enable AWS X-Ray Tracing for Lambda Function. |
vpc |
software.amazon.awscdk.services.ec2.IVpc |
VPC network to place Lambda network interfaces. |
vpcSubnets |
software.amazon.awscdk.services.ec2.SubnetSelection |
Where to place the network interfaces within the VPC. |
code |
software.amazon.awscdk.services.lambda.Code |
The source code of your Lambda function. |
handler |
java.lang.String |
The name of the method within your code that Lambda calls to execute your function. |
runtime |
software.amazon.awscdk.services.lambda.Runtime |
The runtime environment for the Lambda function that you are uploading. |
disableSnapStart |
java.lang.Boolean |
When true, disable snap start. |
scope
Required
- Type: software.constructs.Construct
id
Required
- Type: java.lang.String
maxEventAge
Optional
- Type: software.amazon.awscdk.Duration
- Default: Duration.hours(6)
The maximum age of a request that Lambda sends to a function for processing.
Minimum: 60 seconds Maximum: 6 hours
onFailure
Optional
- Type: software.amazon.awscdk.services.lambda.IDestination
- Default: no destination
The destination for failed invocations.
onSuccess
Optional
- Type: software.amazon.awscdk.services.lambda.IDestination
- Default: no destination
The destination for successful invocations.
retryAttempts
Optional
- Type: java.lang.Number
- Default: 2
The maximum number of times to retry when the function returns an error.
Minimum: 0 Maximum: 2
adotInstrumentation
Optional
- Type: software.amazon.awscdk.services.lambda.AdotInstrumentationConfig
- Default: No ADOT instrumentation
Specify the configuration of AWS Distro for OpenTelemetry (ADOT) instrumentation.
allowAllIpv6Outbound
Optional
- Type: java.lang.Boolean
- Default: false
Whether to allow the Lambda to send all ipv6 network traffic.
If set to true, there will only be a single egress rule which allows all outbound ipv6 traffic. If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets using ipv6.
Do not specify this property if the securityGroups
or securityGroup
property is set.
Instead, configure allowAllIpv6Outbound
directly on the security group.
allowAllOutbound
Optional
- Type: java.lang.Boolean
- Default: true
Whether to allow the Lambda to send all network traffic (except ipv6).
If set to false, you must individually add traffic rules to allow the Lambda to connect to network targets.
Do not specify this property if the securityGroups
or securityGroup
property is set.
Instead, configure allowAllOutbound
directly on the security group.
allowPublicSubnet
Optional
- Type: java.lang.Boolean
- Default: false
Lambda Functions in a public subnet can NOT access the internet.
Use this property to acknowledge this limitation and still place the function in a public subnet.
~~applicationLogLevel
~~Optional
-
Deprecated: Use
applicationLogLevelV2
as a property instead. -
Type: java.lang.String
- Default: "INFO"
Sets the application log level for the function.
applicationLogLevelV2
Optional
- Type: software.amazon.awscdk.services.lambda.ApplicationLogLevel
- Default: ApplicationLogLevel.INFO
Sets the application log level for the function.
architecture
Optional
- Type: software.amazon.awscdk.services.lambda.Architecture
- Default: Architecture.X86_64
The system architectures compatible with this lambda function.
codeSigningConfig
Optional
- Type: software.amazon.awscdk.services.lambda.ICodeSigningConfig
- Default: Not Sign the Code
Code signing config associated with this function.
currentVersionOptions
Optional
- Type: software.amazon.awscdk.services.lambda.VersionOptions
- Default: default options as described in
VersionOptions
Options for the lambda.Version
resource automatically created by the fn.currentVersion
method.
deadLetterQueue
Optional
- Type: software.amazon.awscdk.services.sqs.IQueue
- Default: SQS queue with 14 day retention period if
deadLetterQueueEnabled
istrue
The SQS queue to use if DLQ is enabled.
If SNS topic is desired, specify deadLetterTopic
property instead.
deadLetterQueueEnabled
Optional
- Type: java.lang.Boolean
- Default: false unless
deadLetterQueue
is set, which implies DLQ is enabled.
Enabled DLQ.
If deadLetterQueue
is undefined,
an SQS queue with default options will be defined for your Function.
deadLetterTopic
Optional
- Type: software.amazon.awscdk.services.sns.ITopic
- Default: no SNS topic
The SNS topic to use as a DLQ.
Note that if deadLetterQueueEnabled
is set to true
, an SQS queue will be created
rather than an SNS topic. Using an SNS topic as a DLQ requires this property to be set explicitly.
description
Optional
- Type: java.lang.String
- Default: No description.
A description of the function.
environment
Optional
- Type: java.util.Map
- Default: No environment variables.
Key-value pairs that Lambda caches and makes available for your Lambda functions.
Use environment variables to apply configuration changes, such as test and production environment configurations, without changing your Lambda function source code.
environmentEncryption
Optional
- Type: software.amazon.awscdk.services.kms.IKey
- Default: AWS Lambda creates and uses an AWS managed customer master key (CMK).
The AWS KMS key that's used to encrypt your function's environment variables.
ephemeralStorageSize
Optional
- Type: software.amazon.awscdk.Size
- Default: 512 MiB
The size of the function’s /tmp directory in MiB.
events
Optional
- Type: java.util.List
- Default: No event sources.
Event sources for this function.
You can also add event sources using addEventSource
.
filesystem
Optional
- Type: software.amazon.awscdk.services.lambda.FileSystem
- Default: will not mount any filesystem
The filesystem configuration for the lambda function.
functionName
Optional
- Type: java.lang.String
- Default: AWS CloudFormation generates a unique physical ID and uses that ID for the function's name. For more information, see Name Type.
A name for the function.
initialPolicy
Optional
- Type: java.util.List
- Default: No policy statements are added to the created Lambda role.
Initial policy statements to add to the created Lambda Role.
You can call addToRolePolicy
to the created lambda to add statements post creation.
insightsVersion
Optional
- Type: software.amazon.awscdk.services.lambda.LambdaInsightsVersion
- Default: No Lambda Insights
Specify the version of CloudWatch Lambda insights to use for monitoring.
ipv6AllowedForDualStack
Optional
- Type: java.lang.Boolean
- Default: false
Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets.
Only used if 'vpc' is supplied.
layers
Optional
- Type: java.util.List
- Default: No layers.
A list of layers to add to the function's execution environment.
You can configure your Lambda function to pull in additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies that can be used by multiple functions.
~~logFormat
~~Optional
-
Deprecated: Use
loggingFormat
as a property instead. -
Type: java.lang.String
- Default: "Text"
Sets the logFormat for the function.
loggingFormat
Optional
- Type: software.amazon.awscdk.services.lambda.LoggingFormat
- Default: LoggingFormat.TEXT
Sets the loggingFormat for the function.
logGroup
Optional
- Type: software.amazon.awscdk.services.logs.ILogGroup
- Default:
/aws/lambda/${this.functionName}
- default log group created by Lambda
The log group the function sends logs to.
By default, Lambda functions send logs to an automatically created default log group named /aws/lambda/\<function name>. However you cannot change the properties of this auto-created log group using the AWS CDK, e.g. you cannot set a different log retention.
Use the logGroup
property to create a fully customizable LogGroup ahead of time, and instruct the Lambda function to send logs to it.
Providing a user-controlled log group was rolled out to commercial regions on 2023-11-16. If you are deploying to another type of region, please check regional availability first.
logRetention
Optional
- Type: software.amazon.awscdk.services.logs.RetentionDays
- Default: logs.RetentionDays.INFINITE
The number of days log events are kept in CloudWatch Logs.
When updating
this property, unsetting it doesn't remove the log retention policy. To
remove the retention policy, set the value to INFINITE
.
This is a legacy API and we strongly recommend you move away from it if you can.
Instead create a fully customizable log group with logs.LogGroup
and use the logGroup
property
to instruct the Lambda function to send logs to it.
Migrating from logRetention
to logGroup
will cause the name of the log group to change.
Users and code and referencing the name verbatim will have to adjust.
In AWS CDK code, you can access the log group name directly from the LogGroup construct:
import * as logs from 'aws-cdk-lib/aws-logs';
declare const myLogGroup: logs.LogGroup;
myLogGroup.logGroupName;
logRetentionRetryOptions
Optional
- Type: software.amazon.awscdk.services.lambda.LogRetentionRetryOptions
- Default: Default AWS SDK retry options.
When log retention is specified, a custom resource attempts to create the CloudWatch log group.
These options control the retry policy when interacting with CloudWatch APIs.
This is a legacy API and we strongly recommend you migrate to logGroup
if you can.
logGroup
allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.
logRetentionRole
Optional
- Type: software.amazon.awscdk.services.iam.IRole
- Default: A new role is created.
The IAM role for the Lambda function associated with the custom resource that sets the retention policy.
This is a legacy API and we strongly recommend you migrate to logGroup
if you can.
logGroup
allows you to create a fully customizable log group and instruct the Lambda function to send logs to it.
memorySize
Optional
- Type: java.lang.Number
- Default: 128
The amount of memory, in MB, that is allocated to your Lambda function.
Lambda uses this value to proportionally allocate the amount of CPU power. For more information, see Resource Model in the AWS Lambda Developer Guide.
paramsAndSecrets
Optional
- Type: software.amazon.awscdk.services.lambda.ParamsAndSecretsLayerVersion
- Default: No Parameters and Secrets Extension
Specify the configuration of Parameters and Secrets Extension.
https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html
profiling
Optional
- Type: java.lang.Boolean
- Default: No profiling.
Enable profiling.
https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html
profilingGroup
Optional
- Type: software.amazon.awscdk.services.codeguruprofiler.IProfilingGroup
- Default: A new profiling group will be created if
profiling
is set.
Profiling Group.
https://docs.aws.amazon.com/codeguru/latest/profiler-ug/setting-up-lambda.html
recursiveLoop
Optional
- Type: software.amazon.awscdk.services.lambda.RecursiveLoop
- Default: RecursiveLoop.Terminate
Sets the Recursive Loop Protection for Lambda Function.
It lets Lambda detect and terminate unintended recusrive loops.
reservedConcurrentExecutions
Optional
- Type: java.lang.Number
- Default: No specific limit - account limit.
The maximum of concurrent executions you want to reserve for the function.
https://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html
role
Optional
- Type: software.amazon.awscdk.services.iam.IRole
- Default: A unique role will be generated for this lambda function. Both supplied and generated roles can always be changed by calling
addToRolePolicy
.
Lambda execution role.
This is the role that will be assumed by the function upon execution. It controls the permissions that the function will have. The Role must be assumable by the 'lambda.amazonaws.com' service principal.
The default Role automatically has permissions granted for Lambda execution. If you provide a Role, you must add the relevant AWS managed policies yourself.
The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and "service-role/AWSLambdaVPCAccessExecutionRole".
runtimeManagementMode
Optional
- Type: software.amazon.awscdk.services.lambda.RuntimeManagementMode
- Default: Auto
Sets the runtime management configuration for a function's version.
securityGroups
Optional
- Type: java.util.List
- Default: If the function is placed within a VPC and a security group is not specified, either by this or securityGroup prop, a dedicated security group will be created for this function.
The list of security groups to associate with the Lambda's network interfaces.
Only used if 'vpc' is supplied.
snapStart
Optional
- Type: software.amazon.awscdk.services.lambda.SnapStartConf
- Default: No snapstart
Enable SnapStart for Lambda Function.
SnapStart is currently supported only for Java 11, 17 runtime
~~systemLogLevel
~~Optional
-
Deprecated: Use
systemLogLevelV2
as a property instead. -
Type: java.lang.String
- Default: "INFO"
Sets the system log level for the function.
systemLogLevelV2
Optional
- Type: software.amazon.awscdk.services.lambda.SystemLogLevel
- Default: SystemLogLevel.INFO
Sets the system log level for the function.
timeout
Optional
- Type: software.amazon.awscdk.Duration
- Default: Duration.seconds(3)
The function execution time (in seconds) after which Lambda terminates the function.
Because the execution time affects cost, set this value based on the function's expected execution time.
tracing
Optional
- Type: software.amazon.awscdk.services.lambda.Tracing
- Default: Tracing.Disabled
Enable AWS X-Ray Tracing for Lambda Function.
vpc
Optional
- Type: software.amazon.awscdk.services.ec2.IVpc
- Default: Function is not placed within a VPC.
VPC network to place Lambda network interfaces.
Specify this if the Lambda function needs to access resources in a VPC.
This is required when vpcSubnets
is specified.
vpcSubnets
Optional
- Type: software.amazon.awscdk.services.ec2.SubnetSelection
- Default: the Vpc default strategy if not specified
Where to place the network interfaces within the VPC.
This requires vpc
to be specified in order for interfaces to actually be
placed in the subnets. If vpc
is not specify, this will raise an error.
Note: Internet access for Lambda Functions requires a NAT Gateway, so picking
public subnets is not allowed (unless allowPublicSubnet
is set to true
).
code
Required
- Type: software.amazon.awscdk.services.lambda.Code
The source code of your Lambda function.
You can point to a file in an Amazon Simple Storage Service (Amazon S3) bucket or specify your source code as inline text.
handler
Required
- Type: java.lang.String
The name of the method within your code that Lambda calls to execute your function.
The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/foundation-progmodel.html.
Use Handler.FROM_IMAGE
when defining a function from a Docker image.
NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.
runtime
Required
- Type: software.amazon.awscdk.services.lambda.Runtime
The runtime environment for the Lambda function that you are uploading.
For valid values, see the Runtime property in the AWS Lambda Developer Guide.
Use Runtime.FROM_IMAGE
when defining a function from a Docker image.
disableSnapStart
Optional
- Type: java.lang.Boolean
- Default: false
When true, disable snap start.
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 java.lang.String toString()
Returns a string representation of this construct.
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
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
).
policy
Required
- Type: software.amazon.awscdk.RemovalPolicy
addEventSource
public void addEventSource(IEventSource source)
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));
source
Required
- Type: software.amazon.awscdk.services.lambda.IEventSource
addEventSourceMapping
public EventSourceMapping addEventSourceMapping(java.lang.String id, EventSourceMappingOptions options)
Adds an event source that maps to this AWS Lambda function.
id
Required
- Type: java.lang.String
options
Required
- Type: software.amazon.awscdk.services.lambda.EventSourceMappingOptions
addFunctionUrl
public FunctionUrl addFunctionUrl()
public FunctionUrl addFunctionUrl(FunctionUrlOptions options)
Adds a url to this lambda function.
options
Optional
- Type: software.amazon.awscdk.services.lambda.FunctionUrlOptions
addPermission
public void addPermission(java.lang.String id, Permission permission)
Adds a permission to the Lambda resource policy.
id
Required
- Type: java.lang.String
The id for the permission construct.
permission
Required
- Type: software.amazon.awscdk.services.lambda.Permission
The permission to grant to this Lambda function.
addToRolePolicy
public void addToRolePolicy(PolicyStatement statement)
Adds a statement to the IAM role assumed by the instance.
statement
Required
- Type: software.amazon.awscdk.services.iam.PolicyStatement
configureAsyncInvoke
public void configureAsyncInvoke(EventInvokeConfigOptions options)
Configures options for asynchronous invocation.
options
Required
- Type: software.amazon.awscdk.services.lambda.EventInvokeConfigOptions
considerWarningOnInvokeFunctionPermissions
public void considerWarningOnInvokeFunctionPermissions(Construct scope, java.lang.String action)
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.
scope
Required
- Type: software.constructs.Construct
action
Required
- Type: java.lang.String
grantInvoke
public Grant grantInvoke(IGrantable grantee)
Grant the given identity permissions to invoke this Lambda.
grantee
Required
- Type: software.amazon.awscdk.services.iam.IGrantable
grantInvokeCompositePrincipal
public java.util.List<Grant> grantInvokeCompositePrincipal(CompositePrincipal compositePrincipal)
Grant multiple principals the ability to invoke this Lambda via CompositePrincipal.
compositePrincipal
Required
- Type: software.amazon.awscdk.services.iam.CompositePrincipal
grantInvokeLatestVersion
public Grant grantInvokeLatestVersion(IGrantable grantee)
Grant the given identity permissions to invoke the $LATEST version or unqualified version of this Lambda.
grantee
Required
- Type: software.amazon.awscdk.services.iam.IGrantable
grantInvokeUrl
public Grant grantInvokeUrl(IGrantable grantee)
Grant the given identity permissions to invoke this Lambda Function URL.
grantee
Required
- Type: software.amazon.awscdk.services.iam.IGrantable
grantInvokeVersion
public Grant grantInvokeVersion(IGrantable grantee, IVersion version)
Grant the given identity permissions to invoke the given version of this Lambda.
grantee
Required
- Type: software.amazon.awscdk.services.iam.IGrantable
version
Required
- Type: software.amazon.awscdk.services.lambda.IVersion
metric
public Metric metric(java.lang.String metricName)
public Metric metric(java.lang.String metricName, MetricOptions props)
Return the given named metric for this Function.
metricName
Required
- Type: java.lang.String
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricDuration
public Metric metricDuration()
public Metric metricDuration(MetricOptions props)
How long execution of this Lambda takes.
Average over 5 minutes
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricErrors
public Metric metricErrors()
public Metric metricErrors(MetricOptions props)
How many invocations of this Lambda fail.
Sum over 5 minutes
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricInvocations
public Metric metricInvocations()
public Metric metricInvocations(MetricOptions props)
How often this Lambda is invoked.
Sum over 5 minutes
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricThrottles
public Metric metricThrottles()
public Metric metricThrottles(MetricOptions props)
How often this Lambda is throttled.
Sum over 5 minutes
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
addAlias
public Alias addAlias(java.lang.String aliasName)
public Alias addAlias(java.lang.String aliasName, AliasOptions options)
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,
});
aliasName
Required
- Type: java.lang.String
The name of the alias.
options
Optional
- Type: software.amazon.awscdk.services.lambda.AliasOptions
Alias options.
addEnvironment
public Function addEnvironment(java.lang.String key, java.lang.String value)
public Function addEnvironment(java.lang.String key, java.lang.String value, EnvironmentOptions options)
Adds an environment variable to this Lambda function.
If this is a ref to a Lambda function, this operation results in a no-op.
key
Required
- Type: java.lang.String
The environment variable key.
value
Required
- Type: java.lang.String
The environment variable's value.
options
Optional
- Type: software.amazon.awscdk.services.lambda.EnvironmentOptions
Environment variable options.
addLayers
public void addLayers(ILayerVersion layers)
Adds one or more Lambda Layers to this Lambda function.
layers
Required
- Type: software.amazon.awscdk.services.lambda.ILayerVersion
the layers to be added.
invalidateVersionBasedOn
public void invalidateVersionBasedOn(java.lang.String x)
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.
x
Required
- Type: java.lang.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 software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isOwnedResource
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.isOwnedResource(IConstruct construct)
Returns true if the construct was created by CDK, and false otherwise.
construct
Required
- Type: software.constructs.IConstruct
isResource
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.isResource(IConstruct construct)
Check whether the given construct is a Resource.
construct
Required
- Type: software.constructs.IConstruct
classifyVersionProperty
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.classifyVersionProperty(java.lang.String propertyName, java.lang.Boolean locked)
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.
propertyName
Required
- Type: java.lang.String
The property to classify.
locked
Required
- Type: java.lang.Boolean
whether the property should be associated to the version or not.
fromFunctionArn
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.fromFunctionArn(Construct scope, java.lang.String id, java.lang.String functionArn)
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.
scope
Required
- Type: software.constructs.Construct
id
Required
- Type: java.lang.String
functionArn
Required
- Type: java.lang.String
fromFunctionAttributes
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.fromFunctionAttributes(Construct scope, java.lang.String id, FunctionAttributes attrs)
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.
scope
Required
- Type: software.constructs.Construct
The parent construct.
id
Required
- Type: java.lang.String
The name of the lambda construct.
attrs
Required
- Type: software.amazon.awscdk.services.lambda.FunctionAttributes
the attributes of the function to import.
fromFunctionName
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.fromFunctionName(Construct scope, java.lang.String id, java.lang.String functionName)
Import a lambda function into the CDK using its name.
scope
Required
- Type: software.constructs.Construct
id
Required
- Type: java.lang.String
functionName
Required
- Type: java.lang.String
metricAll
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAll(java.lang.String metricName),SnapStartFunction.metricAll(java.lang.String metricName, MetricOptions props)
Return the given named metric for this Lambda.
metricName
Required
- Type: java.lang.String
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricAllConcurrentExecutions
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAllConcurrentExecutions(),SnapStartFunction.metricAllConcurrentExecutions(MetricOptions props)
Metric for the number of concurrent executions across all Lambdas.
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricAllDuration
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAllDuration(),SnapStartFunction.metricAllDuration(MetricOptions props)
Metric for the Duration executing all Lambdas.
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricAllErrors
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAllErrors(),SnapStartFunction.metricAllErrors(MetricOptions props)
Metric for the number of Errors executing all Lambdas.
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricAllInvocations
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAllInvocations(),SnapStartFunction.metricAllInvocations(MetricOptions props)
Metric for the number of invocations of all Lambdas.
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricAllThrottles
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAllThrottles(),SnapStartFunction.metricAllThrottles(MetricOptions props)
Metric for the number of throttled invocations of all Lambdas.
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
metricAllUnreservedConcurrentExecutions
import software.aws.pdk.type_safe_api.SnapStartFunction;
SnapStartFunction.metricAllUnreservedConcurrentExecutions(),SnapStartFunction.metricAllUnreservedConcurrentExecutions(MetricOptions props)
Metric for the number of unreserved concurrent executions across all Lambdas.
props
Optional
- Type: software.amazon.awscdk.services.cloudwatch.MetricOptions
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
env |
software.amazon.awscdk.ResourceEnvironment |
The environment this resource belongs to. |
stack |
software.amazon.awscdk.Stack |
The stack in which this resource is defined. |
architecture |
software.amazon.awscdk.services.lambda.Architecture |
The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64). |
connections |
software.amazon.awscdk.services.ec2.Connections |
Access the Connections object. |
functionArn |
java.lang.String |
ARN of this function. |
functionName |
java.lang.String |
Name of this function. |
grantPrincipal |
software.amazon.awscdk.services.iam.IPrincipal |
The principal this Lambda Function is running as. |
isBoundToVpc |
java.lang.Boolean |
Whether or not this Lambda function was bound to a VPC. |
latestVersion |
software.amazon.awscdk.services.lambda.IVersion |
The $LATEST version of this function. |
permissionsNode |
software.constructs.Node |
The construct node where permissions are attached. |
resourceArnsForGrantInvoke |
java.util.List |
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke(). |
role |
software.amazon.awscdk.services.iam.IRole |
Execution role associated with this function. |
currentVersion |
software.amazon.awscdk.services.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 |
software.amazon.awscdk.services.logs.ILogGroup |
The LogGroup where the Lambda function's logs are made available. |
runtime |
software.amazon.awscdk.services.lambda.Runtime |
The runtime configured for this lambda. |
deadLetterQueue |
software.amazon.awscdk.services.sqs.IQueue |
The DLQ (as queue) associated with this Lambda Function (this is an optional attribute). |
deadLetterTopic |
software.amazon.awscdk.services.sns.ITopic |
The DLQ (as topic) associated with this Lambda Function (this is an optional attribute). |
timeout |
software.amazon.awscdk.Duration |
The timeout configured for this lambda. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
env
Required
public ResourceEnvironment getEnv();
- Type: software.amazon.awscdk.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.
stack
Required
public Stack getStack();
- Type: software.amazon.awscdk.Stack
The stack in which this resource is defined.
architecture
Required
public Architecture getArchitecture();
- Type: software.amazon.awscdk.services.lambda.Architecture
The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).
connections
Required
public Connections getConnections();
- Type: software.amazon.awscdk.services.ec2.Connections
Access the Connections object.
Will fail if not a VPC-enabled Lambda Function
functionArn
Required
public java.lang.String getFunctionArn();
- Type: java.lang.String
ARN of this function.
functionName
Required
public java.lang.String getFunctionName();
- Type: java.lang.String
Name of this function.
grantPrincipal
Required
public IPrincipal getGrantPrincipal();
- Type: software.amazon.awscdk.services.iam.IPrincipal
The principal this Lambda Function is running as.
isBoundToVpc
Required
public java.lang.Boolean getIsBoundToVpc();
- Type: java.lang.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.
latestVersion
Required
public IVersion getLatestVersion();
- Type: software.amazon.awscdk.services.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.
permissionsNode
Required
public Node getPermissionsNode();
- Type: software.constructs.Node
The construct node where permissions are attached.
resourceArnsForGrantInvoke
Required
public java.util.List<java.lang.String> getResourceArnsForGrantInvoke();
- Type: java.util.List
The ARN(s) to put into the resource field of the generated IAM policy for grantInvoke().
role
Optional
public IRole getRole();
- Type: software.amazon.awscdk.services.iam.IRole
Execution role associated with this function.
currentVersion
Required
public Version getCurrentVersion();
- Type: software.amazon.awscdk.services.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
.
logGroup
Required
public ILogGroup getLogGroup();
- Type: software.amazon.awscdk.services.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.
runtime
Required
public Runtime getRuntime();
- Type: software.amazon.awscdk.services.lambda.Runtime
The runtime configured for this lambda.
deadLetterQueue
Optional
public IQueue getDeadLetterQueue();
- Type: software.amazon.awscdk.services.sqs.IQueue
The DLQ (as queue) associated with this Lambda Function (this is an optional attribute).
deadLetterTopic
Optional
public ITopic getDeadLetterTopic();
- Type: software.amazon.awscdk.services.sns.ITopic
The DLQ (as topic) associated with this Lambda Function (this is an optional attribute).
timeout
Optional
public Duration getTimeout();
- Type: software.amazon.awscdk.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 software.aws.pdk.type_safe_api.TypeSafeApiAsyncModelBuild;
TypeSafeApiAsyncModelBuild.Builder.create(Project project)
.asyncApiSpecFile(java.lang.String)
.parsedSpecFile(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
asyncApiSpecFile |
java.lang.String |
Path to the generated AsyncAPI specification (relative to the project root). |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
project
Required
- Type: io.github.cdklabs.projen.Project
asyncApiSpecFile
Required
- Type: java.lang.String
Path to the generated AsyncAPI specification (relative to the project root).
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.TypeSafeApiAsyncModelBuild;
TypeSafeApiAsyncModelBuild.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.TypeSafeApiAsyncModelBuild;
TypeSafeApiAsyncModelBuild.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
TypeSafeApiModelBuild
Adds the build task for parsing/bundling an OpenAPI spec ready for use by code generation projects.
Initializers
import software.aws.pdk.type_safe_api.TypeSafeApiModelBuild;
TypeSafeApiModelBuild.Builder.create(Project project)
.parsedSpecFile(java.lang.String)
.openApiSpecificationPath(java.lang.String)
// .smithyJsonModelPath(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.Project |
No description. |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
openApiSpecificationPath |
java.lang.String |
Path to the OpenAPI specification. |
smithyJsonModelPath |
java.lang.String |
Optional path to the Smithy JSON model (for Smithy projects only). |
project
Required
- Type: io.github.cdklabs.projen.Project
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
openApiSpecificationPath
Required
- Type: java.lang.String
Path to the OpenAPI specification.
smithyJsonModelPath
Optional
- Type: java.lang.String
Optional path to the Smithy JSON model (for Smithy projects only).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.TypeSafeApiModelBuild;
TypeSafeApiModelBuild.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.TypeSafeApiModelBuild;
TypeSafeApiModelBuild.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.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 software.aws.pdk.type_safe_api.TypeSafeApiProject;
TypeSafeApiProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.infrastructure(InfrastructureConfiguration)
.model(ModelConfiguration)
// .commitGeneratedCode(java.lang.Boolean)
// .documentation(DocumentationConfiguration)
// .handlers(HandlersConfiguration)
// .library(LibraryConfiguration)
// .runtime(RuntimeConfiguration)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
infrastructure |
InfrastructureConfiguration |
Configuration for generated infrastructure. |
model |
ModelConfiguration |
Configuration for the API model. |
commitGeneratedCode |
java.lang.Boolean |
Whether to commit the code generated by the OpenAPI Generator. |
documentation |
DocumentationConfiguration |
Configuration for generated documentation. |
handlers |
HandlersConfiguration |
Configuration for lambda handlers for implementing the API. |
library |
LibraryConfiguration |
Configuration for generated libraries. |
runtime |
RuntimeConfiguration |
Configuration for generated runtime projects (containing types, clients and server code). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
infrastructure
Required
Configuration for generated infrastructure.
model
Required
- Type: ModelConfiguration
Configuration for the API model.
commitGeneratedCode
Optional
- Type: java.lang.Boolean
- Default: false
Whether to commit the code generated by the OpenAPI Generator.
documentation
Optional
Configuration for generated documentation.
handlers
Optional
- Type: HandlersConfiguration
Configuration for lambda handlers for implementing the API.
library
Optional
- Type: LibraryConfiguration
Configuration for generated libraries.
Libraries are projects which are generated from your model, but are not fully-fledged runtimes, for example react hooks or clients in languages that aren't supported as runtimes.
runtime
Optional
- Type: RuntimeConfiguration
Configuration for generated runtime projects (containing types, clients and server code).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.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 software.aws.pdk.type_safe_api.TypeSafeApiProject;
TypeSafeApiProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.TypeSafeApiProject;
TypeSafeApiProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.TypeSafeApiProject;
TypeSafeApiProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.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. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
all
Required
public ProjectCollections getAll();
- Type: ProjectCollections
Collections of all sub-projects managed by this project.
documentation
Required
public GeneratedDocumentationProjects getDocumentation();
Generated documentation projects.
Only the properties corresponding to specified documentation.formats
will be defined.
handlers
Required
public GeneratedCodeProjects getHandlers();
- Type: GeneratedCodeProjects
Lambda handlers projects.
Only the properties corresponding to handlers.languages
will be defined.
infrastructure
Required
public GeneratedCodeProjects getInfrastructure();
- Type: GeneratedCodeProjects
Generated infrastructure projects.
Only the property corresponding to infrastructure.language
will be defined.
library
Required
public GeneratedLibraryProjects getLibrary();
- Type: GeneratedLibraryProjects
Generated library projects.
Only the properties corresponding to specified library.libraries
will be defined.
model
Required
public ModelProject getModel();
- Type: ModelProject
Project for the api model.
runtime
Required
public GeneratedCodeProjects getRuntime();
- Type: 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 |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.TypeSafeRestApi;
TypeSafeRestApi.Builder.create(Construct scope, java.lang.String id)
// .cloudWatchRole(java.lang.Boolean)
// .cloudWatchRoleRemovalPolicy(RemovalPolicy)
// .deploy(java.lang.Boolean)
// .deployOptions(StageOptions)
// .description(java.lang.String)
// .disableExecuteApiEndpoint(java.lang.Boolean)
// .domainName(DomainNameOptions)
// .endpointExportName(java.lang.String)
// .endpointTypes(java.util.List<EndpointType>)
// .failOnWarnings(java.lang.Boolean)
// .parameters(java.util.Map<java.lang.String, java.lang.String>)
// .policy(PolicyDocument)
// .restApiName(java.lang.String)
// .retainDeployments(java.lang.Boolean)
.integrations(java.util.Map<java.lang.String, TypeSafeApiIntegration>)
.operationLookup(java.util.Map<java.lang.String, OperationDetails>)
// .apiKeyOptions(ApiKeyOptions)
// .corsOptions(CorsOptions)
// .defaultAuthorizer(Authorizer)
.specPath(java.lang.String)
// .minCompressionSize(Size)
// .outputSpecBucket(IBucket)
// .webAclOptions(TypeSafeApiWebAclOptions)
.build();
Name | Type | Description |
---|---|---|
scope |
software.constructs.Construct |
No description. |
id |
java.lang.String |
No description. |
cloudWatchRole |
java.lang.Boolean |
Automatically configure an AWS CloudWatch role for API Gateway. |
cloudWatchRoleRemovalPolicy |
software.amazon.awscdk.RemovalPolicy |
The removal policy applied to the AWS CloudWatch role when this resource is removed from the application. |
deploy |
java.lang.Boolean |
Indicates if a Deployment should be automatically created for this API, and recreated when the API model (resources, methods) changes. |
deployOptions |
software.amazon.awscdk.services.apigateway.StageOptions |
Options for the API Gateway stage that will always point to the latest deployment when deploy is enabled. |
description |
java.lang.String |
A description of the RestApi construct. |
disableExecuteApiEndpoint |
java.lang.Boolean |
Specifies whether clients can invoke the API using the default execute-api endpoint. |
domainName |
software.amazon.awscdk.services.apigateway.DomainNameOptions |
Configure a custom domain name and map it to this API. |
endpointExportName |
java.lang.String |
Export name for the CfnOutput containing the API endpoint. |
endpointTypes |
java.util.List |
A list of the endpoint types of the API. |
failOnWarnings |
java.lang.Boolean |
Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource. |
parameters |
java.util.Map |
Custom header parameters for the request. |
policy |
software.amazon.awscdk.services.iam.PolicyDocument |
A policy document that contains the permissions for this RestApi. |
restApiName |
java.lang.String |
A name for the API Gateway RestApi resource. |
retainDeployments |
java.lang.Boolean |
Retains old deployment resources when the API changes. |
integrations |
java.util.Map |
A mapping of API operation to its integration. |
operationLookup |
java.util.Map |
Details about each operation. |
apiKeyOptions |
ApiKeyOptions |
Options for API keys. |
corsOptions |
software.amazon.awscdk.services.apigateway.CorsOptions |
Cross Origin Resource Sharing options for the API. |
defaultAuthorizer |
Authorizer |
The default authorizer to use for your api. |
specPath |
java.lang.String |
Path to the JSON open api spec. |
minCompressionSize |
software.amazon.awscdk.Size |
A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (when undefined) on an API. |
outputSpecBucket |
software.amazon.awscdk.services.s3.IBucket |
By default, the spec is prepared and outputted into the CDK assets bucket. |
webAclOptions |
TypeSafeApiWebAclOptions |
Options for the AWS WAF v2 WebACL associated with the api. |
scope
Required
- Type: software.constructs.Construct
id
Required
- Type: java.lang.String
cloudWatchRole
Optional
- Type: java.lang.Boolean
- Default: false if
@aws-cdk/aws-apigateway:disableCloudWatchRole
is enabled, true otherwise
Automatically configure an AWS CloudWatch role for API Gateway.
cloudWatchRoleRemovalPolicy
Optional
- Type: software.amazon.awscdk.RemovalPolicy
- Default: RemovalPolicy.RETAIN
The removal policy applied to the AWS CloudWatch role when this resource is removed from the application.
Requires cloudWatchRole
 to be enabled.
deploy
Optional
- Type: java.lang.Boolean
- Default: true
Indicates if a Deployment should be automatically created for this API, and recreated when the API model (resources, methods) changes.
Since API Gateway deployments are immutable, When this option is enabled (by default), an AWS::ApiGateway::Deployment resource will automatically created with a logical ID that hashes the API model (methods, resources and options). This means that when the model changes, the logical ID of this CloudFormation resource will change, and a new deployment will be created.
If this is set, latestDeployment
will refer to the Deployment
object
and deploymentStage
will refer to a Stage
that points to this
deployment. To customize the stage options, use the deployOptions
property.
A CloudFormation Output will also be defined with the root URL endpoint of this REST API.
deployOptions
Optional
- Type: software.amazon.awscdk.services.apigateway.StageOptions
- Default: Based on defaults of
StageOptions
.
Options for the API Gateway stage that will always point to the latest deployment when deploy
is enabled.
If deploy
is disabled,
this value cannot be set.
description
Optional
- Type: java.lang.String
- Default: 'Automatically created by the RestApi construct'
A description of the RestApi construct.
disableExecuteApiEndpoint
Optional
- Type: java.lang.Boolean
- Default: false
Specifies whether clients can invoke the API using the default execute-api endpoint.
To require that clients use a custom domain name to invoke the API, disable the default endpoint.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html
domainName
Optional
- Type: software.amazon.awscdk.services.apigateway.DomainNameOptions
- Default: no domain name is defined, use
addDomainName
or directly define aDomainName
.
Configure a custom domain name and map it to this API.
endpointExportName
Optional
- Type: java.lang.String
- Default: when no export name is given, output will be created without export
Export name for the CfnOutput containing the API endpoint.
endpointTypes
Optional
- Type: java.util.List
- Default: EndpointType.EDGE
A list of the endpoint types of the API.
Use this property when creating an API.
failOnWarnings
Optional
- Type: java.lang.Boolean
- Default: false
Indicates whether to roll back the resource if a warning occurs while API Gateway is creating the RestApi resource.
parameters
Optional
- Type: java.util.Map
- Default: No parameters.
Custom header parameters for the request.
https://docs.aws.amazon.com/cli/latest/reference/apigateway/import-rest-api.html
policy
Optional
- Type: software.amazon.awscdk.services.iam.PolicyDocument
- Default: No policy.
A policy document that contains the permissions for this RestApi.
restApiName
Optional
- Type: java.lang.String
- Default: ID of the RestApi construct.
A name for the API Gateway RestApi resource.
retainDeployments
Optional
- Type: java.lang.Boolean
- Default: false
Retains old deployment resources when the API changes.
This allows manually reverting stages to point to old deployments via the AWS Console.
integrations
Required
- Type: java.util.Map
TypeSafeApiIntegration\>
A mapping of API operation to its integration.
operationLookup
Required
- Type: java.util.Map
OperationDetails\>
Details about each operation.
apiKeyOptions
Optional
- Type: ApiKeyOptions
Options for API keys.
corsOptions
Optional
- Type: software.amazon.awscdk.services.apigateway.CorsOptions
Cross Origin Resource Sharing options for the API.
defaultAuthorizer
Optional
- Type: Authorizer
The default authorizer to use for your api.
When omitted, no default authorizer is used. Authorizers specified at the integration level will override this for that operation.
specPath
Required
- Type: java.lang.String
Path to the JSON open api spec.
minCompressionSize
Optional
- Type: software.amazon.awscdk.Size
- Default: Compression is disabled.
A Size(in bytes, kibibytes, mebibytes etc) that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (when undefined) on an API.
When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.
outputSpecBucket
Optional
- Type: software.amazon.awscdk.services.s3.IBucket
By default, the spec is prepared and outputted into the CDK assets bucket.
If this is undesired, use this option to specify the output bucket.
webAclOptions
Optional
- Type: TypeSafeApiWebAclOptions
Options for the AWS WAF v2 WebACL associated with the api.
By default, a Web ACL with the AWS default managed rule set will be associated with the API. These options may disable or override the defaults.
Methods
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
Static Functions
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isConstruct
import software.aws.pdk.type_safe_api.TypeSafeRestApi;
TypeSafeRestApi.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
api |
software.amazon.awscdk.services.apigateway.SpecRestApi |
Underlying API Gateway API construct. |
extendedApiSpecification |
java.lang.Object |
The OpenAPI specification with applied API gateway extensions. |
ipSet |
software.amazon.awscdk.services.wafv2.CfnIPSet |
Reference to the IP set if created. |
webAcl |
software.amazon.awscdk.services.wafv2.CfnWebACL |
Reference to the webacl, if created. |
webAclAssociation |
software.amazon.awscdk.services.wafv2.CfnWebACLAssociation |
Reference to the web acl association if created. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
api
Required
public SpecRestApi getApi();
- Type: software.amazon.awscdk.services.apigateway.SpecRestApi
Underlying API Gateway API construct.
extendedApiSpecification
Required
public java.lang.Object getExtendedApiSpecification();
- Type: java.lang.Object
The OpenAPI specification with applied API gateway extensions.
ipSet
Optional
public CfnIPSet getIpSet();
- Type: software.amazon.awscdk.services.wafv2.CfnIPSet
Reference to the IP set if created.
webAcl
Optional
public CfnWebACL getWebAcl();
- Type: software.amazon.awscdk.services.wafv2.CfnWebACL
Reference to the webacl, if created.
webAclAssociation
Optional
public CfnWebACLAssociation getWebAclAssociation();
- Type: software.amazon.awscdk.services.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 software.aws.pdk.type_safe_api.TypeSafeWebsocketApi;
TypeSafeWebsocketApi.Builder.create(Construct scope, java.lang.String id)
// .apiKeySelectionExpression(WebSocketApiKeySelectionExpression)
// .apiName(java.lang.String)
// .description(java.lang.String)
.integrations(java.util.Map<java.lang.String, TypeSafeWebsocketApiIntegration>)
.operationLookup(java.util.Map<java.lang.String, WebsocketOperationDetails>)
.specPath(java.lang.String)
// .authorizer(IWebSocketRouteAuthorizer)
// .connect(TypeSafeWebsocketApiIntegration)
// .disableAccessLogging(java.lang.Boolean)
// .disableGrantManagementAccessToLambdas(java.lang.Boolean)
// .disableMockIntegrationResponses(java.lang.Boolean)
// .disconnect(TypeSafeWebsocketApiIntegration)
// .stageProps(WebSocketStageProps)
.build();
Name | Type | Description |
---|---|---|
scope |
software.constructs.Construct |
No description. |
id |
java.lang.String |
No description. |
apiKeySelectionExpression |
software.amazon.awscdk.services.apigatewayv2.WebSocketApiKeySelectionExpression |
An API key selection expression. |
apiName |
java.lang.String |
Name for the WebSocket API resource. |
description |
java.lang.String |
The description of the API. |
integrations |
java.util.Map |
WebSocket routes and their corresponding integrations. |
operationLookup |
java.util.Map |
Details about each operation. |
specPath |
java.lang.String |
Path to the websocket api specification json file. |
authorizer |
software.amazon.awscdk.services.apigatewayv2.IWebSocketRouteAuthorizer |
Authorizer to use for the API (applied to the $connect route). |
connect |
TypeSafeWebsocketApiIntegration |
Integration for the $connect route (invoked when a new client connects). |
disableAccessLogging |
java.lang.Boolean |
Disable access logging. |
disableGrantManagementAccessToLambdas |
java.lang.Boolean |
By default, all lambda integrations are granted management API access for the websocket API to send messages, disconnect clients, etc. |
disableMockIntegrationResponses |
java.lang.Boolean |
By default, all mock integrations will automatically be configured with integration responses such that the integration is considered successful. |
disconnect |
TypeSafeWebsocketApiIntegration |
Integration for the $disconnect route (invoked when a client disconnects). |
stageProps |
WebSocketStageProps |
Options for the default stage. |
scope
Required
- Type: software.constructs.Construct
id
Required
- Type: java.lang.String
apiKeySelectionExpression
Optional
- Type: software.amazon.awscdk.services.apigatewayv2.WebSocketApiKeySelectionExpression
- Default: Key is not required to access these APIs
An API key selection expression.
Providing this option will require an API Key be provided to access the API.
apiName
Optional
- Type: java.lang.String
- Default: id of the WebSocketApi construct.
Name for the WebSocket API resource.
description
Optional
- Type: java.lang.String
- Default: none
The description of the API.
integrations
Required
- Type: java.util.Map
TypeSafeWebsocketApiIntegration\>
WebSocket routes and their corresponding integrations.
operationLookup
Required
- Type: java.util.Map
WebsocketOperationDetails\>
Details about each operation.
specPath
Required
- Type: java.lang.String
Path to the websocket api specification json file.
authorizer
Optional
- Type: software.amazon.awscdk.services.apigatewayv2.IWebSocketRouteAuthorizer
- Default: NONE
Authorizer to use for the API (applied to the $connect route).
connect
Optional
- Type: TypeSafeWebsocketApiIntegration
- Default: mocked
Integration for the $connect route (invoked when a new client connects).
disableAccessLogging
Optional
- Type: java.lang.Boolean
- Default: false
Disable access logging.
disableGrantManagementAccessToLambdas
Optional
- Type: java.lang.Boolean
- Default: false
By default, all lambda integrations are granted management API access for the websocket API to send messages, disconnect clients, etc.
Set to true if you would like to manage these permissions manually.
disableMockIntegrationResponses
Optional
- Type: java.lang.Boolean
- Default: false
By default, all mock integrations will automatically be configured with integration responses such that the integration is considered successful.
Set to true to disable this (mock integrations will respond with errors)
disconnect
Optional
- Type: TypeSafeWebsocketApiIntegration
- Default: mocked
Integration for the $disconnect route (invoked when a client disconnects).
stageProps
Optional
- Type: WebSocketStageProps
Options for the default stage.
Methods
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
Static Functions
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isConstruct
import software.aws.pdk.type_safe_api.TypeSafeWebsocketApi;
TypeSafeWebsocketApi.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
api |
software.amazon.awscdk.services.apigatewayv2.WebSocketApi |
Reference to the websocket API. |
defaultStage |
software.amazon.awscdk.services.apigatewayv2.WebSocketStage |
Reference to the default deploy stage. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
api
Required
public WebSocketApi getApi();
- Type: software.amazon.awscdk.services.apigatewayv2.WebSocketApi
Reference to the websocket API.
defaultStage
Required
public WebSocketStage getDefaultStage();
- Type: software.amazon.awscdk.services.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 software.aws.pdk.type_safe_api.TypeSafeWebSocketApiProject;
TypeSafeWebSocketApiProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
.infrastructure(WebSocketInfrastructureConfiguration)
.model(TypeSafeWebSocketApiModelConfiguration)
// .documentation(WebSocketDocumentationConfiguration)
// .handlers(WebSocketHandlersConfiguration)
// .library(WebSocketLibraryConfiguration)
// .runtime(WebSocketRuntimeConfiguration)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
infrastructure |
WebSocketInfrastructureConfiguration |
Configuration for generated infrastructure. |
model |
TypeSafeWebSocketApiModelConfiguration |
Configuration for the API model. |
documentation |
WebSocketDocumentationConfiguration |
Configuration for generated documentation. |
handlers |
WebSocketHandlersConfiguration |
Configuration for lambda handlers for implementing the API. |
library |
WebSocketLibraryConfiguration |
Configuration for generated libraries. |
runtime |
WebSocketRuntimeConfiguration |
Configuration for generated runtime projects (containing types, clients and server code). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
infrastructure
Required
Configuration for generated infrastructure.
model
Required
Configuration for the API model.
documentation
Optional
Configuration for generated documentation.
handlers
Optional
Configuration for lambda handlers for implementing the API.
library
Optional
Configuration for generated libraries.
These include clients for interacting with your websocket API
runtime
Optional
Configuration for generated runtime projects (containing types, clients and server code).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String _pattern)
Exclude these files from the bundled package.
Implemented by project types based on the
packaging mechanism. For example, NodeProject
delegates this to .npmignore
.
_pattern
Required
- Type: java.lang.String
The glob pattern to exclude.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String _glob)
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.
_glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
By default, this is npx projen@<version> <task>
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.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 software.aws.pdk.type_safe_api.TypeSafeWebSocketApiProject;
TypeSafeWebSocketApiProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.TypeSafeWebSocketApiProject;
TypeSafeWebSocketApiProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.TypeSafeWebSocketApiProject;
TypeSafeWebSocketApiProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.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. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
all
Required
public ProjectCollections getAll();
- Type: ProjectCollections
Collections of all sub-projects managed by this project.
documentation
Required
public GeneratedWebSocketDocumentationProjects getDocumentation();
Generated documentation projects.
Only the properties corresponding to specified documentation.formats
will be defined.
handlers
Required
public GeneratedCodeProjects getHandlers();
- Type: GeneratedCodeProjects
Lambda handlers projects.
Only the properties corresponding to handlers.languages
will be defined.
infrastructure
Required
public GeneratedCodeProjects getInfrastructure();
- Type: GeneratedCodeProjects
Generated infrastructure projects.
Only the property corresponding to infrastructure.language
will be defined.
library
Required
public GeneratedWebSocketLibraryProjects getLibrary();
Generated library projects.
Only the properties corresponding to specified library.libraries
will be defined.
model
Required
public WebSocketModelProject getModel();
- Type: WebSocketModelProject
Project for the api model.
runtime
Required
public GeneratedCodeProjects getRuntime();
- Type: 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 |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.TypeSpecAsyncDefinition;
TypeSpecAsyncDefinition.Builder.create(NodeProject project)
.typeSpecOptions(TypeSpecModelOptions)
// .handlerLanguages(java.util.List<Language>)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.javascript.NodeProject |
No description. |
typeSpecOptions |
TypeSpecModelOptions |
TypeSpec model options. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
project
Required
- Type: io.github.cdklabs.projen.javascript.NodeProject
typeSpecOptions
Required
- Type: TypeSpecModelOptions
TypeSpec model options.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.TypeSpecAsyncDefinition;
TypeSpecAsyncDefinition.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isComponent
import software.aws.pdk.type_safe_api.TypeSpecAsyncDefinition;
TypeSpecAsyncDefinition.isComponent(java.lang.Object x)
Test whether the given construct is a component.
x
Required
- Type: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
project |
io.github.cdklabs.projen.Project |
No description. |
openApiSpecificationPath |
java.lang.String |
Path to the generated OpenAPI specification. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
project
Required
public Project getProject();
- Type: io.github.cdklabs.projen.Project
openApiSpecificationPath
Required
public java.lang.String getOpenApiSpecificationPath();
- Type: java.lang.String
Path to the generated OpenAPI specification.
TypeSpecAsyncModelProject
Model project for defining a WebSocket API in TypeSpec.
Initializers
import software.aws.pdk.type_safe_api.TypeSpecAsyncModelProject;
TypeSpecAsyncModelProject.Builder.create()
.name(java.lang.String)
// .commitGenerated(java.lang.Boolean)
// .gitIgnoreOptions(IgnoreFileOptions)
// .gitOptions(GitOptions)
// .logging(LoggerOptions)
// .outdir(java.lang.String)
// .parent(Project)
// .projenCommand(java.lang.String)
// .projenrcJson(java.lang.Boolean)
// .projenrcJsonOptions(ProjenrcJsonOptions)
// .renovatebot(java.lang.Boolean)
// .renovatebotOptions(RenovatebotOptions)
// .autoApproveOptions(AutoApproveOptions)
// .autoMerge(java.lang.Boolean)
// .autoMergeOptions(AutoMergeOptions)
// .clobber(java.lang.Boolean)
// .devContainer(java.lang.Boolean)
// .github(java.lang.Boolean)
// .githubOptions(GitHubOptions)
// .gitpod(java.lang.Boolean)
// .mergify(java.lang.Boolean)
// .mergifyOptions(MergifyOptions)
// .projectType(ProjectType)
// .projenCredentials(GithubCredentials)
// .projenTokenSecret(java.lang.String)
// .readme(SampleReadmeProps)
// .stale(java.lang.Boolean)
// .staleOptions(StaleOptions)
// .vscode(java.lang.Boolean)
// .allowLibraryDependencies(java.lang.Boolean)
// .authorEmail(java.lang.String)
// .authorName(java.lang.String)
// .authorOrganization(java.lang.Boolean)
// .authorUrl(java.lang.String)
// .autoDetectBin(java.lang.Boolean)
// .bin(java.util.Map<java.lang.String, java.lang.String>)
// .bugsEmail(java.lang.String)
// .bugsUrl(java.lang.String)
// .bundledDeps(java.util.List<java.lang.String>)
// .codeArtifactOptions(CodeArtifactOptions)
// .deps(java.util.List<java.lang.String>)
// .description(java.lang.String)
// .devDeps(java.util.List<java.lang.String>)
// .entrypoint(java.lang.String)
// .homepage(java.lang.String)
// .keywords(java.util.List<java.lang.String>)
// .license(java.lang.String)
// .licensed(java.lang.Boolean)
// .maxNodeVersion(java.lang.String)
// .minNodeVersion(java.lang.String)
// .npmAccess(NpmAccess)
// .npmProvenance(java.lang.Boolean)
// .npmRegistry(java.lang.String)
// .npmRegistryUrl(java.lang.String)
// .npmTokenSecret(java.lang.String)
// .packageManager(NodePackageManager)
// .packageName(java.lang.String)
// .peerDependencyOptions(PeerDependencyOptions)
// .peerDeps(java.util.List<java.lang.String>)
// .pnpmVersion(java.lang.String)
// .repository(java.lang.String)
// .repositoryDirectory(java.lang.String)
// .scopedPackagesOptions(java.util.List<ScopedPackagesOptions>)
// .scripts(java.util.Map<java.lang.String, java.lang.String>)
// .stability(java.lang.String)
// .yarnBerryOptions(YarnBerryOptions)
// .jsiiReleaseVersion(java.lang.String)
// .majorVersion(java.lang.Number)
// .minMajorVersion(java.lang.Number)
// .npmDistTag(java.lang.String)
// .postBuildSteps(java.util.List<JobStep>)
// .prerelease(java.lang.String)
// .publishDryRun(java.lang.Boolean)
// .publishTasks(java.lang.Boolean)
// .releasableCommits(ReleasableCommits)
// .releaseBranches(java.util.Map<java.lang.String, BranchOptions>)
// .releaseEveryCommit(java.lang.Boolean)
// .releaseFailureIssue(java.lang.Boolean)
// .releaseFailureIssueLabel(java.lang.String)
// .releaseSchedule(java.lang.String)
// .releaseTagPrefix(java.lang.String)
// .releaseTrigger(ReleaseTrigger)
// .releaseWorkflowName(java.lang.String)
// .releaseWorkflowSetupSteps(java.util.List<JobStep>)
// .versionrcOptions(java.util.Map<java.lang.String, java.lang.Object>)
// .workflowContainerImage(java.lang.String)
// .workflowRunsOn(java.util.List<java.lang.String>)
// .workflowRunsOnGroup(GroupRunnerOptions)
.defaultReleaseBranch(java.lang.String)
// .artifactsDirectory(java.lang.String)
// .autoApproveUpgrades(java.lang.Boolean)
// .buildWorkflow(java.lang.Boolean)
// .buildWorkflowOptions(BuildWorkflowOptions)
// .buildWorkflowTriggers(Triggers)
// .bundlerOptions(BundlerOptions)
// .checkLicenses(LicenseCheckerOptions)
// .codeCov(java.lang.Boolean)
// .codeCovTokenSecret(java.lang.String)
// .copyrightOwner(java.lang.String)
// .copyrightPeriod(java.lang.String)
// .dependabot(java.lang.Boolean)
// .dependabotOptions(DependabotOptions)
// .depsUpgrade(java.lang.Boolean)
// .depsUpgradeOptions(UpgradeDependenciesOptions)
// .gitignore(java.util.List<java.lang.String>)
// .jest(java.lang.Boolean)
// .jestOptions(JestOptions)
// .mutableBuild(java.lang.Boolean)
// .npmignore(java.util.List<java.lang.String>)
// .npmignoreEnabled(java.lang.Boolean)
// .npmIgnoreOptions(IgnoreFileOptions)
// .package(java.lang.Boolean)
// .prettier(java.lang.Boolean)
// .prettierOptions(PrettierOptions)
// .projenDevDependency(java.lang.Boolean)
// .projenrcJs(java.lang.Boolean)
// .projenrcJsOptions(ProjenrcOptions)
// .projenVersion(java.lang.String)
// .pullRequestTemplate(java.lang.Boolean)
// .pullRequestTemplateContents(java.util.List<java.lang.String>)
// .release(java.lang.Boolean)
// .releaseToNpm(java.lang.Boolean)
// .releaseWorkflow(java.lang.Boolean)
// .workflowBootstrapSteps(java.util.List<JobStep>)
// .workflowGitIdentity(GitIdentity)
// .workflowNodeVersion(java.lang.String)
// .workflowPackageCache(java.lang.Boolean)
.typeSpecOptions(TypeSpecModelOptions)
// .handlerLanguages(java.util.List<Language>)
.asyncApiSpecFile(java.lang.String)
.parsedSpecFile(java.lang.String)
.build();
Name | Type | Description |
---|---|---|
name |
java.lang.String |
This is the name of your project. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
gitIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .gitignore file. |
gitOptions |
io.github.cdklabs.projen.GitOptions |
Configuration options for git. |
logging |
io.github.cdklabs.projen.LoggerOptions |
Configure logging options such as verbosity. |
outdir |
java.lang.String |
The root directory of the project. |
parent |
io.github.cdklabs.projen.Project |
The parent project, if this project is part of a bigger project. |
projenCommand |
java.lang.String |
The shell command to use in order to run the projen CLI. |
projenrcJson |
java.lang.Boolean |
Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation. |
projenrcJsonOptions |
io.github.cdklabs.projen.ProjenrcJsonOptions |
Options for .projenrc.json. |
renovatebot |
java.lang.Boolean |
Use renovatebot to handle dependency upgrades. |
renovatebotOptions |
io.github.cdklabs.projen.RenovatebotOptions |
Options for renovatebot. |
autoApproveOptions |
io.github.cdklabs.projen.github.AutoApproveOptions |
Enable and configure the 'auto approve' workflow. |
autoMerge |
java.lang.Boolean |
Enable automatic merging on GitHub. |
autoMergeOptions |
io.github.cdklabs.projen.github.AutoMergeOptions |
Configure options for automatic merging on GitHub. |
clobber |
java.lang.Boolean |
Add a clobber task which resets the repo to origin. |
devContainer |
java.lang.Boolean |
Add a VSCode development environment (used for GitHub Codespaces). |
github |
java.lang.Boolean |
Enable GitHub integration. |
githubOptions |
io.github.cdklabs.projen.github.GitHubOptions |
Options for GitHub integration. |
gitpod |
java.lang.Boolean |
Add a Gitpod development environment. |
mergify |
java.lang.Boolean |
Whether mergify should be enabled on this repository or not. |
mergifyOptions |
io.github.cdklabs.projen.github.MergifyOptions |
Options for mergify. |
projectType |
io.github.cdklabs.projen.ProjectType |
Which type of project this is (library/app). |
projenCredentials |
io.github.cdklabs.projen.github.GithubCredentials |
Choose a method of providing GitHub API access for projen workflows. |
projenTokenSecret |
java.lang.String |
The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows. |
readme |
io.github.cdklabs.projen.SampleReadmeProps |
The README setup. |
stale |
java.lang.Boolean |
Auto-close of stale issues and pull request. |
staleOptions |
io.github.cdklabs.projen.github.StaleOptions |
Auto-close stale issues and pull requests. |
vscode |
java.lang.Boolean |
Enable VSCode integration. |
allowLibraryDependencies |
java.lang.Boolean |
Allow the project to include peerDependencies and bundledDependencies . |
authorEmail |
java.lang.String |
Author's e-mail. |
authorName |
java.lang.String |
Author's name. |
authorOrganization |
java.lang.Boolean |
Is the author an organization. |
authorUrl |
java.lang.String |
Author's URL / Website. |
autoDetectBin |
java.lang.Boolean |
Automatically add all executables under the bin directory to your package.json file under the bin section. |
bin |
java.util.Map |
Binary programs vended with your module. |
bugsEmail |
java.lang.String |
The email address to which issues should be reported. |
bugsUrl |
java.lang.String |
The url to your project's issue tracker. |
bundledDeps |
java.util.List |
List of dependencies to bundle into this module. |
codeArtifactOptions |
io.github.cdklabs.projen.javascript.CodeArtifactOptions |
Options for npm packages using AWS CodeArtifact. |
deps |
java.util.List |
Runtime dependencies of this module. |
description |
java.lang.String |
The description is just a string that helps people understand the purpose of the package. |
devDeps |
java.util.List |
Build dependencies for this module. |
entrypoint |
java.lang.String |
Module entrypoint (main in package.json ). |
homepage |
java.lang.String |
Package's Homepage / Website. |
keywords |
java.util.List |
Keywords to include in package.json . |
license |
java.lang.String |
License's SPDX identifier. |
licensed |
java.lang.Boolean |
Indicates if a license should be added. |
maxNodeVersion |
java.lang.String |
Minimum node.js version to require via engines (inclusive). |
minNodeVersion |
java.lang.String |
Minimum Node.js version to require via package.json engines (inclusive). |
npmAccess |
io.github.cdklabs.projen.javascript.NpmAccess |
Access level of the npm package. |
npmProvenance |
java.lang.Boolean |
Should provenance statements be generated when the package is published. |
npmRegistry |
java.lang.String |
The host name of the npm registry to publish to. |
npmRegistryUrl |
java.lang.String |
The base URL of the npm package registry. |
npmTokenSecret |
java.lang.String |
GitHub secret which contains the NPM token to use when publishing packages. |
packageManager |
io.github.cdklabs.projen.javascript.NodePackageManager |
The Node Package Manager used to execute scripts. |
packageName |
java.lang.String |
The "name" in package.json. |
peerDependencyOptions |
io.github.cdklabs.projen.javascript.PeerDependencyOptions |
Options for peerDeps . |
peerDeps |
java.util.List |
Peer dependencies for this module. |
pnpmVersion |
java.lang.String |
The version of PNPM to use if using PNPM as a package manager. |
repository |
java.lang.String |
The repository is the location where the actual code for your package lives. |
repositoryDirectory |
java.lang.String |
If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives. |
scopedPackagesOptions |
java.util.List |
Options for privately hosted scoped packages. |
scripts |
java.util.Map |
npm scripts to include. |
stability |
java.lang.String |
Package's Stability. |
yarnBerryOptions |
io.github.cdklabs.projen.javascript.YarnBerryOptions |
Options for Yarn Berry. |
jsiiReleaseVersion |
java.lang.String |
Version requirement of publib which is used to publish modules to npm. |
majorVersion |
java.lang.Number |
Major version to release from the default branch. |
minMajorVersion |
java.lang.Number |
Minimal Major version to release. |
npmDistTag |
java.lang.String |
The npmDistTag to use when publishing from the default branch. |
postBuildSteps |
java.util.List |
Steps to execute after build as part of the release workflow. |
prerelease |
java.lang.String |
Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). |
publishDryRun |
java.lang.Boolean |
Instead of actually publishing to package managers, just print the publishing command. |
publishTasks |
java.lang.Boolean |
Define publishing tasks that can be executed manually as well as workflows. |
releasableCommits |
io.github.cdklabs.projen.ReleasableCommits |
Find commits that should be considered releasable Used to decide if a release is required. |
releaseBranches |
java.util.Map |
Defines additional release branches. |
releaseEveryCommit |
java.lang.Boolean |
Automatically release new versions every commit to one of branches in releaseBranches . |
releaseFailureIssue |
java.lang.Boolean |
Create a github issue on every failed publishing task. |
releaseFailureIssueLabel |
java.lang.String |
The label to apply to issues indicating publish failures. |
releaseSchedule |
java.lang.String |
CRON schedule to trigger new releases. |
releaseTagPrefix |
java.lang.String |
Automatically add the given prefix to release tags. Useful if you are releasing on multiple branches with overlapping version numbers. |
releaseTrigger |
io.github.cdklabs.projen.release.ReleaseTrigger |
The release trigger to use. |
releaseWorkflowName |
java.lang.String |
The name of the default release workflow. |
releaseWorkflowSetupSteps |
java.util.List |
A set of workflow steps to execute in order to setup the workflow container. |
versionrcOptions |
java.util.Map |
Custom configuration used when creating changelog with standard-version package. |
workflowContainerImage |
java.lang.String |
Container image to use for GitHub workflows. |
workflowRunsOn |
java.util.List |
Github Runner selection labels. |
workflowRunsOnGroup |
io.github.cdklabs.projen.GroupRunnerOptions |
Github Runner Group selection options. |
defaultReleaseBranch |
java.lang.String |
The name of the main release branch. |
artifactsDirectory |
java.lang.String |
A directory which will contain build artifacts. |
autoApproveUpgrades |
java.lang.Boolean |
Automatically approve deps upgrade PRs, allowing them to be merged by mergify (if configued). |
buildWorkflow |
java.lang.Boolean |
Define a GitHub workflow for building PRs. |
buildWorkflowOptions |
io.github.cdklabs.projen.javascript.BuildWorkflowOptions |
Options for PR build workflow. |
buildWorkflowTriggers |
io.github.cdklabs.projen.github.workflows.Triggers |
Build workflow triggers. |
bundlerOptions |
io.github.cdklabs.projen.javascript.BundlerOptions |
Options for Bundler . |
checkLicenses |
io.github.cdklabs.projen.javascript.LicenseCheckerOptions |
Configure which licenses should be deemed acceptable for use by dependencies. |
codeCov |
java.lang.Boolean |
Define a GitHub workflow step for sending code coverage metrics to https://codecov.io/ Uses codecov/codecov-action@v4 A secret is required for private repos. Configured with @codeCovTokenSecret . |
codeCovTokenSecret |
java.lang.String |
Define the secret name for a specified https://codecov.io/ token A secret is required to send coverage for private repositories. |
copyrightOwner |
java.lang.String |
License copyright owner. |
copyrightPeriod |
java.lang.String |
The copyright years to put in the LICENSE file. |
dependabot |
java.lang.Boolean |
Use dependabot to handle dependency upgrades. |
dependabotOptions |
io.github.cdklabs.projen.github.DependabotOptions |
Options for dependabot. |
depsUpgrade |
java.lang.Boolean |
Use tasks and github workflows to handle dependency upgrades. |
depsUpgradeOptions |
io.github.cdklabs.projen.javascript.UpgradeDependenciesOptions |
Options for UpgradeDependencies . |
gitignore |
java.util.List |
Additional entries to .gitignore. |
jest |
java.lang.Boolean |
Setup jest unit tests. |
jestOptions |
io.github.cdklabs.projen.javascript.JestOptions |
Jest options. |
mutableBuild |
java.lang.Boolean |
Automatically update files modified during builds to pull-request branches. |
npmignore |
java.util.List |
Additional entries to .npmignore. |
npmignoreEnabled |
java.lang.Boolean |
Defines an .npmignore file. Normally this is only needed for libraries that are packaged as tarballs. |
npmIgnoreOptions |
io.github.cdklabs.projen.IgnoreFileOptions |
Configuration options for .npmignore file. |
package |
java.lang.Boolean |
Defines a package task that will produce an npm tarball under the artifacts directory (e.g. dist ). |
prettier |
java.lang.Boolean |
Setup prettier. |
prettierOptions |
io.github.cdklabs.projen.javascript.PrettierOptions |
Prettier options. |
projenDevDependency |
java.lang.Boolean |
Indicates of "projen" should be installed as a devDependency. |
projenrcJs |
java.lang.Boolean |
Generate (once) .projenrc.js (in JavaScript). Set to false in order to disable .projenrc.js generation. |
projenrcJsOptions |
io.github.cdklabs.projen.javascript.ProjenrcOptions |
Options for .projenrc.js. |
projenVersion |
java.lang.String |
Version of projen to install. |
pullRequestTemplate |
java.lang.Boolean |
Include a GitHub pull request template. |
pullRequestTemplateContents |
java.util.List |
The contents of the pull request template. |
release |
java.lang.Boolean |
Add release management to this project. |
releaseToNpm |
java.lang.Boolean |
Automatically release to npm when new versions are introduced. |
releaseWorkflow |
java.lang.Boolean |
DEPRECATED: renamed to release . |
workflowBootstrapSteps |
java.util.List |
Workflow steps to use in order to bootstrap this repo. |
workflowGitIdentity |
io.github.cdklabs.projen.github.GitIdentity |
The git identity to use in workflows. |
workflowNodeVersion |
java.lang.String |
The node version to use in GitHub workflows. |
workflowPackageCache |
java.lang.Boolean |
Enable Node.js package cache in GitHub workflows. |
typeSpecOptions |
TypeSpecModelOptions |
TypeSpec model options. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
asyncApiSpecFile |
java.lang.String |
Path to the generated AsyncAPI specification (relative to the project root). |
parsedSpecFile |
java.lang.String |
Path of the parsed/bundled OpenAPI specification (relative to the project root). |
name
Required
- Type: java.lang.String
- Default: $BASEDIR
This is the name of your project.
commitGenerated
Optional
- Type: java.lang.Boolean
- Default: true
Whether to commit the managed files by default.
gitIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .gitignore file.
gitOptions
Optional
- Type: io.github.cdklabs.projen.GitOptions
Configuration options for git.
logging
Optional
- Type: io.github.cdklabs.projen.LoggerOptions
- Default: {}
Configure logging options such as verbosity.
outdir
Optional
- Type: java.lang.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.
parent
Optional
- Type: io.github.cdklabs.projen.Project
The parent project, if this project is part of a bigger project.
projenCommand
Optional
- Type: java.lang.String
- Default: "npx projen"
The shell command to use in order to run the projen CLI.
Can be used to customize in special environments.
projenrcJson
Optional
- Type: java.lang.Boolean
- Default: false
Generate (once) .projenrc.json (in JSON). Set to false
in order to disable .projenrc.json generation.
projenrcJsonOptions
Optional
- Type: io.github.cdklabs.projen.ProjenrcJsonOptions
- Default: default options
Options for .projenrc.json.
renovatebot
Optional
- Type: java.lang.Boolean
- Default: false
Use renovatebot to handle dependency upgrades.
renovatebotOptions
Optional
- Type: io.github.cdklabs.projen.RenovatebotOptions
- Default: default options
Options for renovatebot.
autoApproveOptions
Optional
- Type: io.github.cdklabs.projen.github.AutoApproveOptions
- Default: auto approve is disabled
Enable and configure the 'auto approve' workflow.
autoMerge
Optional
- Type: java.lang.Boolean
- Default: true
Enable automatic merging on GitHub.
Has no effect if github.mergify
is set to false.
autoMergeOptions
Optional
- Type: io.github.cdklabs.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.
clobber
Optional
- Type: java.lang.Boolean
- Default: true, but false for subprojects
Add a clobber
task which resets the repo to origin.
devContainer
Optional
- Type: java.lang.Boolean
- Default: false
Add a VSCode development environment (used for GitHub Codespaces).
github
Optional
- Type: java.lang.Boolean
- Default: true
Enable GitHub integration.
Enabled by default for root projects. Disabled for non-root projects.
githubOptions
Optional
- Type: io.github.cdklabs.projen.github.GitHubOptions
- Default: see GitHubOptions
Options for GitHub integration.
gitpod
Optional
- Type: java.lang.Boolean
- Default: false
Add a Gitpod development environment.
~~mergify
~~Optional
-
Deprecated: use
githubOptions.mergify
instead -
Type: java.lang.Boolean
- Default: true
Whether mergify should be enabled on this repository or not.
~~mergifyOptions
~~Optional
-
Deprecated: use
githubOptions.mergifyOptions
instead -
Type: io.github.cdklabs.projen.github.MergifyOptions
- Default: default options
Options for mergify.
~~projectType
~~Optional
-
Deprecated: no longer supported at the base project level
-
Type: io.github.cdklabs.projen.ProjectType
- Default: ProjectType.UNKNOWN
Which type of project this is (library/app).
projenCredentials
Optional
- Type: io.github.cdklabs.projen.github.GithubCredentials
- Default: use a personal access token named PROJEN_GITHUB_TOKEN
Choose a method of providing GitHub API access for projen workflows.
~~projenTokenSecret
~~Optional
-
Deprecated: use
projenCredentials
-
Type: java.lang.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.
readme
Optional
- Type: io.github.cdklabs.projen.SampleReadmeProps
- Default: { filename: 'README.md', contents: '# replace this' }
The README setup.
Example
"{ filename: 'readme.md', contents: '# title' }"
stale
Optional
- Type: java.lang.Boolean
- Default: false
Auto-close of stale issues and pull request.
See staleOptions
for options.
staleOptions
Optional
- Type: io.github.cdklabs.projen.github.StaleOptions
- Default: see defaults in
StaleOptions
Auto-close stale issues and pull requests.
To disable set stale
to false
.
vscode
Optional
- Type: java.lang.Boolean
- Default: true
Enable VSCode integration.
Enabled by default for root projects. Disabled for non-root projects.
allowLibraryDependencies
Optional
- Type: java.lang.Boolean
- Default: true
Allow the project to include peerDependencies
and bundledDependencies
.
This is normally only allowed for libraries. For apps, there's no meaning for specifying these.
authorEmail
Optional
- Type: java.lang.String
Author's e-mail.
authorName
Optional
- Type: java.lang.String
Author's name.
authorOrganization
Optional
- Type: java.lang.Boolean
Is the author an organization.
authorUrl
Optional
- Type: java.lang.String
Author's URL / Website.
autoDetectBin
Optional
- Type: java.lang.Boolean
- Default: true
Automatically add all executables under the bin
directory to your package.json
file under the bin
section.
bin
Optional
- Type: java.util.Map
Binary programs vended with your module.
You can use this option to add/customize how binaries are represented in
your package.json
, but unless autoDetectBin
is false
, every
executable file under bin
will automatically be added to this section.
bugsEmail
Optional
- Type: java.lang.String
The email address to which issues should be reported.
bugsUrl
Optional
- Type: java.lang.String
The url to your project's issue tracker.
bundledDeps
Optional
- Type: java.util.List
List of dependencies to bundle into this module.
These modules will be
added both to the dependencies
section and bundledDependencies
section of
your package.json
.
The recommendation is to only specify the module name here (e.g.
express
). This will behave similar to yarn add
or npm install
in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^
). You can specify semver requirements in
the same syntax passed to npm i
or yarn add
(e.g. express@^2
) and
this will be what you package.json
will eventually include.
codeArtifactOptions
Optional
- Type: io.github.cdklabs.projen.javascript.CodeArtifactOptions
- Default: undefined
Options for npm packages using AWS CodeArtifact.
This is required if publishing packages to, or installing scoped packages from AWS CodeArtifact
deps
Optional
- Type: java.util.List
- Default: []
Runtime dependencies of this module.
The recommendation is to only specify the module name here (e.g.
express
). This will behave similar to yarn add
or npm install
in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^
). You can specify semver requirements in
the same syntax passed to npm i
or yarn add
(e.g. express@^2
) and
this will be what you package.json
will eventually include.
Example
[ 'express', 'lodash', 'foo@^2' ]
description
Optional
- Type: java.lang.String
The description is just a string that helps people understand the purpose of the package.
It can be used when searching for packages in a package manager as well. See https://classic.yarnpkg.com/en/docs/package-json/#toc-description
devDeps
Optional
- Type: java.util.List
- Default: []
Build dependencies for this module.
These dependencies will only be available in your build environment but will not be fetched when this module is consumed.
The recommendation is to only specify the module name here (e.g.
express
). This will behave similar to yarn add
or npm install
in the
sense that it will add the module as a dependency to your package.json
file with the latest version (^
). You can specify semver requirements in
the same syntax passed to npm i
or yarn add
(e.g. express@^2
) and
this will be what you package.json
will eventually include.
Example
[ 'typescript', '@types/express' ]
entrypoint
Optional
- Type: java.lang.String
- Default: "lib/index.js"
Module entrypoint (main
in package.json
).
Set to an empty string to not include main
in your package.json
homepage
Optional
- Type: java.lang.String
Package's Homepage / Website.
keywords
Optional
- Type: java.util.List
Keywords to include in package.json
.
license
Optional
- Type: java.lang.String
- Default: "Apache-2.0"
License's SPDX identifier.
See https://github.com/projen/projen/tree/main/license-text for a list of supported licenses.
Use the licensed
option if you want to no license to be specified.
licensed
Optional
- Type: java.lang.Boolean
- Default: true
Indicates if a license should be added.
maxNodeVersion
Optional
- Type: java.lang.String
- Default: no max
Minimum node.js version to require via engines
(inclusive).
minNodeVersion
Optional
- Type: java.lang.String
- Default: no "engines" specified
Minimum Node.js version to require via package.json engines
(inclusive).
npmAccess
Optional
- Type: io.github.cdklabs.projen.javascript.NpmAccess
- Default: for scoped packages (e.g.
foo@bar
), the default isNpmAccess.RESTRICTED
, for non-scoped packages, the default isNpmAccess.PUBLIC
.
Access level of the npm package.
npmProvenance
Optional
- Type: java.lang.Boolean
- Default: true for public packages, false otherwise
Should provenance statements be generated when the package is published.
A supported package manager is required to publish a package with npm provenance statements and you will need to use a supported CI/CD provider.
Note that the projen Release
and Publisher
components are using publib
to publish packages,
which is using npm internally and supports provenance statements independently of the package manager used.
~~npmRegistry
~~Optional
-
Deprecated: use
npmRegistryUrl
instead -
Type: java.lang.String
The host name of the npm registry to publish to.
Cannot be set together with npmRegistryUrl
.
npmRegistryUrl
Optional
- Type: java.lang.String
- Default: "https://registry.npmjs.org"
The base URL of the npm package registry.
Must be a URL (e.g. start with "https://" or "http://")
npmTokenSecret
Optional
- Type: java.lang.String
- Default: "NPM_TOKEN"
GitHub secret which contains the NPM token to use when publishing packages.
packageManager
Optional
- Type: io.github.cdklabs.projen.javascript.NodePackageManager
- Default: NodePackageManager.YARN_CLASSIC
The Node Package Manager used to execute scripts.
packageName
Optional
- Type: java.lang.String
- Default: defaults to project name
The "name" in package.json.
peerDependencyOptions
Optional
- Type: io.github.cdklabs.projen.javascript.PeerDependencyOptions
Options for peerDeps
.
peerDeps
Optional
- Type: java.util.List
- Default: []
Peer dependencies for this module.
Dependencies listed here are required to
be installed (and satisfied) by the consumer of this library. Using peer
dependencies allows you to ensure that only a single module of a certain
library exists in the node_modules
tree of your consumers.
Note that prior to npm@7, peer dependencies are not automatically installed, which means that adding peer dependencies to a library will be a breaking change for your customers.
Unless peerDependencyOptions.pinnedDevDependency
is disabled (it is
enabled by default), projen will automatically add a dev dependency with a
pinned version for each peer dependency. This will ensure that you build &
test your module against the lowest peer version required.
pnpmVersion
Optional
- Type: java.lang.String
- Default: "7"
The version of PNPM to use if using PNPM as a package manager.
repository
Optional
- Type: java.lang.String
The repository is the location where the actual code for your package lives.
See https://classic.yarnpkg.com/en/docs/package-json/#toc-repository
repositoryDirectory
Optional
- Type: java.lang.String
If the package.json for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives.
scopedPackagesOptions
Optional
- Type: java.util.List
- Default: fetch all scoped packages from the public npm registry
Options for privately hosted scoped packages.
~~scripts
~~Optional
-
Deprecated: use
project.addTask()
orpackage.setScript()
-
Type: java.util.Map
- Default: {}
npm scripts to include.
If a script has the same name as a standard script, the standard script will be overwritten. Also adds the script as a task.
stability
Optional
- Type: java.lang.String
Package's Stability.
yarnBerryOptions
Optional
- Type: io.github.cdklabs.projen.javascript.YarnBerryOptions
- Default: Yarn Berry v4 with all default options
Options for Yarn Berry.
jsiiReleaseVersion
Optional
- Type: java.lang.String
- Default: "latest"
Version requirement of publib
which is used to publish modules to npm.
majorVersion
Optional
- Type: java.lang.Number
- Default: Major version is not enforced.
Major version to release from the default branch.
If this is specified, we bump the latest version of this major version line. If not specified, we bump the global latest version.
minMajorVersion
Optional
- Type: java.lang.Number
- Default: No minimum version is being enforced
Minimal Major version to release.
This can be useful to set to 1, as breaking changes before the 1.x major release are not incrementing the major version number.
Can not be set together with majorVersion
.
npmDistTag
Optional
- Type: java.lang.String
- Default: "latest"
The npmDistTag to use when publishing from the default branch.
To set the npm dist-tag for release branches, set the npmDistTag
property
for each branch.
postBuildSteps
Optional
- Type: java.util.List
- Default: []
Steps to execute after build as part of the release workflow.
prerelease
Optional
- Type: java.lang.String
- Default: normal semantic versions
Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre").
publishDryRun
Optional
- Type: java.lang.Boolean
- Default: false
Instead of actually publishing to package managers, just print the publishing command.
publishTasks
Optional
- Type: java.lang.Boolean
- Default: false
Define publishing tasks that can be executed manually as well as workflows.
Normally, publishing only happens within automated workflows. Enable this in order to create a publishing task for each publishing activity.
releasableCommits
Optional
- Type: io.github.cdklabs.projen.ReleasableCommits
- Default: ReleasableCommits.everyCommit()
Find commits that should be considered releasable Used to decide if a release is required.
releaseBranches
Optional
- Type: java.util.Map
- Default: no additional branches are used for release. you can use
addBranch()
to add additional branches.
Defines additional release branches.
A workflow will be created for each
release branch which will publish releases from commits in this branch.
Each release branch must be assigned a major version number which is used
to enforce that versions published from that branch always use that major
version. If multiple branches are used, the majorVersion
field must also
be provided for the default branch.
~~releaseEveryCommit
~~Optional
-
Deprecated: Use
releaseTrigger: ReleaseTrigger.continuous()
instead -
Type: java.lang.Boolean
- Default: true
Automatically release new versions every commit to one of branches in releaseBranches
.
releaseFailureIssue
Optional
- Type: java.lang.Boolean
- Default: false
Create a github issue on every failed publishing task.
releaseFailureIssueLabel
Optional
- Type: java.lang.String
- Default: "failed-release"
The label to apply to issues indicating publish failures.
Only applies if releaseFailureIssue
is true.
~~releaseSchedule
~~Optional
-
Deprecated: Use
releaseTrigger: ReleaseTrigger.scheduled()
instead -
Type: java.lang.String
- Default: no scheduled releases
CRON schedule to trigger new releases.
releaseTagPrefix
Optional
- Type: java.lang.String
- Default: "v"
Automatically add the given prefix to release tags. Useful if you are releasing on multiple branches with overlapping version numbers.
Note: this prefix is used to detect the latest tagged version when bumping, so if you change this on a project with an existing version history, you may need to manually tag your latest release with the new prefix.
releaseTrigger
Optional
- Type: io.github.cdklabs.projen.release.ReleaseTrigger
- Default: Continuous releases (
ReleaseTrigger.continuous()
)
The release trigger to use.
releaseWorkflowName
Optional
- Type: java.lang.String
- Default: "release"
The name of the default release workflow.
releaseWorkflowSetupSteps
Optional
- Type: java.util.List
A set of workflow steps to execute in order to setup the workflow container.
versionrcOptions
Optional
- Type: java.util.Map
- Default: standard configuration applicable for GitHub repositories
Custom configuration used when creating changelog with standard-version package.
Given values either append to default configuration or overwrite values in it.
workflowContainerImage
Optional
- Type: java.lang.String
- Default: default image
Container image to use for GitHub workflows.
workflowRunsOn
Optional
- Type: java.util.List
- Default: ["ubuntu-latest"]
Github Runner selection labels.
workflowRunsOnGroup
Optional
- Type: io.github.cdklabs.projen.GroupRunnerOptions
Github Runner Group selection options.
defaultReleaseBranch
Required
- Type: java.lang.String
- Default: "main"
The name of the main release branch.
artifactsDirectory
Optional
- Type: java.lang.String
- Default: "dist"
A directory which will contain build artifacts.
autoApproveUpgrades
Optional
- Type: java.lang.Boolean
- Default: true
Automatically approve deps upgrade PRs, allowing them to be merged by mergify (if configued).
Throw if set to true but autoApproveOptions
are not defined.
buildWorkflow
Optional
- Type: java.lang.Boolean
- Default: true if not a subproject
Define a GitHub workflow for building PRs.
buildWorkflowOptions
Optional
- Type: io.github.cdklabs.projen.javascript.BuildWorkflowOptions
Options for PR build workflow.
~~buildWorkflowTriggers
~~Optional
-
Deprecated: - Use
buildWorkflowOptions.workflowTriggers
-
Type: io.github.cdklabs.projen.github.workflows.Triggers
- Default: "{ pullRequest: {}, workflowDispatch: {} }"
Build workflow triggers.
bundlerOptions
Optional
- Type: io.github.cdklabs.projen.javascript.BundlerOptions
Options for Bundler
.
checkLicenses
Optional
- Type: io.github.cdklabs.projen.javascript.LicenseCheckerOptions
- Default: no license checks are run during the build and all licenses will be accepted
Configure which licenses should be deemed acceptable for use by dependencies.
This setting will cause the build to fail, if any prohibited or not allowed licenses ares encountered.
codeCov
Optional
- Type: java.lang.Boolean
- Default: false
Define a GitHub workflow step for sending code coverage metrics to https://codecov.io/ Uses codecov/codecov-action@v4 A secret is required for private repos. Configured with @codeCovTokenSecret
.
codeCovTokenSecret
Optional
- Type: java.lang.String
- Default: if this option is not specified, only public repositories are supported
Define the secret name for a specified https://codecov.io/ token A secret is required to send coverage for private repositories.
copyrightOwner
Optional
- Type: java.lang.String
- Default: defaults to the value of authorName or "" if
authorName
is undefined.
License copyright owner.
copyrightPeriod
Optional
- Type: java.lang.String
- Default: current year
The copyright years to put in the LICENSE file.
dependabot
Optional
- Type: java.lang.Boolean
- Default: false
Use dependabot to handle dependency upgrades.
Cannot be used in conjunction with depsUpgrade
.
dependabotOptions
Optional
- Type: io.github.cdklabs.projen.github.DependabotOptions
- Default: default options
Options for dependabot.
depsUpgrade
Optional
- Type: java.lang.Boolean
- Default: true
Use tasks and github workflows to handle dependency upgrades.
Cannot be used in conjunction with dependabot
.
depsUpgradeOptions
Optional
- Type: io.github.cdklabs.projen.javascript.UpgradeDependenciesOptions
- Default: default options
Options for UpgradeDependencies
.
gitignore
Optional
- Type: java.util.List
Additional entries to .gitignore.
jest
Optional
- Type: java.lang.Boolean
- Default: true
Setup jest unit tests.
jestOptions
Optional
- Type: io.github.cdklabs.projen.javascript.JestOptions
- Default: default options
Jest options.
~~mutableBuild
~~Optional
-
Deprecated: - Use
buildWorkflowOptions.mutableBuild
-
Type: java.lang.Boolean
- Default: true
Automatically update files modified during builds to pull-request branches.
This means that any files synthesized by projen or e.g. test snapshots will always be up-to-date before a PR is merged.
Implies that PR builds do not have anti-tamper checks.
~~npmignore
~~Optional
-
Deprecated: - use
project.addPackageIgnore
-
Type: java.util.List
Additional entries to .npmignore.
npmignoreEnabled
Optional
- Type: java.lang.Boolean
- Default: true
Defines an .npmignore file. Normally this is only needed for libraries that are packaged as tarballs.
npmIgnoreOptions
Optional
- Type: io.github.cdklabs.projen.IgnoreFileOptions
Configuration options for .npmignore file.
package
Optional
- Type: java.lang.Boolean
- Default: true
Defines a package
task that will produce an npm tarball under the artifacts directory (e.g. dist
).
prettier
Optional
- Type: java.lang.Boolean
- Default: false
Setup prettier.
prettierOptions
Optional
- Type: io.github.cdklabs.projen.javascript.PrettierOptions
- Default: default options
Prettier options.
projenDevDependency
Optional
- Type: java.lang.Boolean
- Default: true if not a subproject
Indicates of "projen" should be installed as a devDependency.
projenrcJs
Optional
- Type: java.lang.Boolean
- Default: true if projenrcJson is false
Generate (once) .projenrc.js (in JavaScript). Set to false
in order to disable .projenrc.js generation.
projenrcJsOptions
Optional
- Type: io.github.cdklabs.projen.javascript.ProjenrcOptions
- Default: default options
Options for .projenrc.js.
projenVersion
Optional
- Type: java.lang.String
- Default: Defaults to the latest version.
Version of projen to install.
pullRequestTemplate
Optional
- Type: java.lang.Boolean
- Default: true
Include a GitHub pull request template.
pullRequestTemplateContents
Optional
- Type: java.util.List
- Default: default content
The contents of the pull request template.
release
Optional
- Type: java.lang.Boolean
- Default: true (false for subprojects)
Add release management to this project.
releaseToNpm
Optional
- Type: java.lang.Boolean
- Default: false
Automatically release to npm when new versions are introduced.
~~releaseWorkflow
~~Optional
-
Deprecated: see
release
. -
Type: java.lang.Boolean
- Default: true if not a subproject
DEPRECATED: renamed to release
.
workflowBootstrapSteps
Optional
- Type: java.util.List
- Default: "yarn install --frozen-lockfile && yarn projen"
Workflow steps to use in order to bootstrap this repo.
workflowGitIdentity
Optional
- Type: io.github.cdklabs.projen.github.GitIdentity
- Default: GitHub Actions
The git identity to use in workflows.
workflowNodeVersion
Optional
- Type: java.lang.String
- Default: same as
minNodeVersion
The node version to use in GitHub workflows.
workflowPackageCache
Optional
- Type: java.lang.Boolean
- Default: false
Enable Node.js package cache in GitHub workflows.
typeSpecOptions
Required
- Type: TypeSpecModelOptions
TypeSpec model options.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
asyncApiSpecFile
Required
- Type: java.lang.String
Path to the generated AsyncAPI specification (relative to the project root).
parsedSpecFile
Required
- Type: java.lang.String
Path of the parsed/bundled OpenAPI specification (relative to the project root).
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 java.lang.String toString()
Returns a string representation of this construct.
addExcludeFromCleanup
public void addExcludeFromCleanup(java.lang.String globs)
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.
globs
Required
- Type: java.lang.String
The glob patterns to match.
addGitIgnore
public void addGitIgnore(java.lang.String pattern)
Adds a .gitignore pattern.
pattern
Required
- Type: java.lang.String
The glob pattern to ignore.
addPackageIgnore
public void addPackageIgnore(java.lang.String pattern)
Adds patterns to be ignored by npm.
pattern
Required
- Type: java.lang.String
The pattern to ignore.
addTask
public Task addTask(java.lang.String name)
public Task addTask(java.lang.String name, TaskOptions props)
Adds a new task to this project.
This will fail if the project already has a task with this name.
name
Required
- Type: java.lang.String
The task name to add.
props
Optional
- Type: io.github.cdklabs.projen.TaskOptions
Task properties.
~~addTip
~~
public void addTip(java.lang.String message)
Prints a "tip" message during synthesis.
message
Required
- Type: java.lang.String
The message.
annotateGenerated
public void annotateGenerated(java.lang.String glob)
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
glob
Required
- Type: java.lang.String
the glob pattern to match (could be a file path).
postSynthesize
public void postSynthesize()
Called after all components are synthesized.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before all components are synthesized.
removeTask
public Task removeTask(java.lang.String name)
Removes a task from a project.
name
Required
- Type: java.lang.String
The name of the task to remove.
runTaskCommand
public java.lang.String runTaskCommand(Task task)
Returns the shell command to execute in order to run a task.
This will
typically be npx projen TASK
.
task
Required
- Type: io.github.cdklabs.projen.Task
The task for which the command is required.
synth
public void synth()
Synthesize all project files into outdir
.
- Call "this.preSynthesize()"
- Delete all generated files
- Synthesize all subprojects
- Synthesize all components of this project
- Call "postSynthesize()" for all components of this project
- Call "this.postSynthesize()"
tryFindFile
public FileBase tryFindFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and all its subprojects.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
~~tryFindJsonFile
~~
public JsonFile tryFindJsonFile(java.lang.String filePath)
Finds a json file by name.
filePath
Required
- Type: java.lang.String
The file path.
tryFindObjectFile
public ObjectFile tryFindObjectFile(java.lang.String filePath)
Finds an object file (like JsonFile, YamlFile, etc.) by name.
filePath
Required
- Type: java.lang.String
The file path.
tryRemoveFile
public FileBase tryRemoveFile(java.lang.String filePath)
Finds a file at the specified relative path within this project and removes it.
filePath
Required
- Type: java.lang.String
The file path.
If this path is relative, it will be resolved from the root of this project.
addBins
public void addBins(java.util.Map<java.lang.String, java.lang.String> bins)
bins
Required
- Type: java.util.Map
addBundledDeps
public void addBundledDeps(java.lang.String deps)
Defines bundled dependencies.
Bundled dependencies will be added as normal dependencies as well as to the
bundledDependencies
section of your package.json
.
deps
Required
- Type: java.lang.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 void addCompileCommand(java.lang.String commands)
DEPRECATED.
commands
Required
- Type: java.lang.String
addDeps
public void addDeps(java.lang.String deps)
Defines normal dependencies.
deps
Required
- Type: java.lang.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 void addDevDeps(java.lang.String deps)
Defines development/test dependencies.
deps
Required
- Type: java.lang.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 void addFields(java.util.Map<java.lang.String, java.lang.Object> fields)
Directly set fields in package.json
.
fields
Required
- Type: java.util.Map
The fields to set.
addKeywords
public void addKeywords(java.lang.String keywords)
Adds keywords to package.json (deduplicated).
keywords
Required
- Type: java.lang.String
The keywords to add.
addPeerDeps
public void addPeerDeps(java.lang.String deps)
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.
deps
Required
- Type: java.lang.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 void addScripts(java.util.Map<java.lang.String, java.lang.String> scripts)
Replaces the contents of multiple npm package.json scripts.
scripts
Required
- Type: java.util.Map
The scripts to set.
~~addTestCommand
~~
public void addTestCommand(java.lang.String commands)
DEPRECATED.
commands
Required
- Type: java.lang.String
~~hasScript
~~
public java.lang.Boolean hasScript(java.lang.String name)
Indicates if a script by the name name is defined.
name
Required
- Type: java.lang.String
The name of the script.
removeScript
public void removeScript(java.lang.String name)
Removes the npm script (always successful).
name
Required
- Type: java.lang.String
The name of the script.
renderWorkflowSetup
public java.util.List<JobStep> renderWorkflowSetup()
public java.util.List<JobStep> renderWorkflowSetup(RenderWorkflowSetupOptions options)
Returns the set of workflow steps which should be executed to bootstrap a workflow.
options
Optional
- Type: io.github.cdklabs.projen.javascript.RenderWorkflowSetupOptions
Options.
setScript
public void setScript(java.lang.String name, java.lang.String command)
Replaces the contents of an npm package.json script.
name
Required
- Type: java.lang.String
The script name.
command
Required
- Type: java.lang.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 software.aws.pdk.type_safe_api.TypeSpecAsyncModelProject;
TypeSpecAsyncModelProject.isConstruct(java.lang.Object x)
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.
x
Required
- Type: java.lang.Object
Any object.
isProject
import software.aws.pdk.type_safe_api.TypeSpecAsyncModelProject;
TypeSpecAsyncModelProject.isProject(java.lang.Object x)
Test whether the given construct is a project.
x
Required
- Type: java.lang.Object
of
import software.aws.pdk.type_safe_api.TypeSpecAsyncModelProject;
TypeSpecAsyncModelProject.of(IConstruct construct)
Find the closest ancestor project for given construct.
When given a project, this it the project itself.
construct
Required
- Type: software.constructs.IConstruct
Properties
Name | Type | Description |
---|---|---|
node |
software.constructs.Node |
The tree node. |
buildTask |
io.github.cdklabs.projen.Task |
No description. |
commitGenerated |
java.lang.Boolean |
Whether to commit the managed files by default. |
compileTask |
io.github.cdklabs.projen.Task |
No description. |
components |
java.util.List |
Returns all the components within this project. |
deps |
io.github.cdklabs.projen.Dependencies |
Project dependencies. |
ejected |
java.lang.Boolean |
Whether or not the project is being ejected. |
files |
java.util.List |
All files in this project. |
gitattributes |
io.github.cdklabs.projen.GitAttributesFile |
The .gitattributes file for this repository. |
gitignore |
io.github.cdklabs.projen.IgnoreFile |
.gitignore. |
logger |
io.github.cdklabs.projen.Logger |
Logging utilities. |
name |
java.lang.String |
Project name. |
outdir |
java.lang.String |
Absolute output directory of this project. |
packageTask |
io.github.cdklabs.projen.Task |
No description. |
postCompileTask |
io.github.cdklabs.projen.Task |
No description. |
preCompileTask |
io.github.cdklabs.projen.Task |
No description. |
projectBuild |
io.github.cdklabs.projen.ProjectBuild |
Manages the build process of the project. |
projenCommand |
java.lang.String |
The command to use in order to run the projen CLI. |
root |
io.github.cdklabs.projen.Project |
The root project. |
subprojects |
java.util.List |
Returns all the subprojects within this project. |
tasks |
io.github.cdklabs.projen.Tasks |
Project tasks. |
testTask |
io.github.cdklabs.projen.Task |
No description. |
defaultTask |
io.github.cdklabs.projen.Task |
This is the "default" task, the one that executes "projen". |
initProject |
io.github.cdklabs.projen.InitProject |
The options used when this project is bootstrapped via projen new . |
parent |
io.github.cdklabs.projen.Project |
A parent project. |
projectType |
io.github.cdklabs.projen.ProjectType |
No description. |
autoApprove |
io.github.cdklabs.projen.github.AutoApprove |
Auto approve set up for this project. |
devContainer |
io.github.cdklabs.projen.vscode.DevContainer |
Access for .devcontainer.json (used for GitHub Codespaces). |
github |
io.github.cdklabs.projen.github.GitHub |
Access all github components. |
gitpod |
io.github.cdklabs.projen.Gitpod |
Access for Gitpod. |
vscode |
io.github.cdklabs.projen.vscode.VsCode |
Access all VSCode components. |
allowLibraryDependencies |
java.lang.Boolean |
No description. |
artifactsDirectory |
java.lang.String |
The build output directory. |
artifactsJavascriptDirectory |
java.lang.String |
The location of the npm tarball after build (${artifactsDirectory}/js ). |
bundler |
io.github.cdklabs.projen.javascript.Bundler |
No description. |
entrypoint |
java.lang.String |
No description. |
manifest |
java.lang.Object |
No description. |
npmrc |
io.github.cdklabs.projen.javascript.NpmConfig |
The .npmrc file. |
package |
io.github.cdklabs.projen.javascript.NodePackage |
API for managing the node package. |
packageManager |
io.github.cdklabs.projen.javascript.NodePackageManager |
The package manager to use. |
runScriptCommand |
java.lang.String |
The command to use to run scripts (e.g. yarn run or npm run depends on the package manager). |
autoMerge |
io.github.cdklabs.projen.github.AutoMerge |
Component that sets up mergify for merging approved pull requests. |
buildWorkflow |
io.github.cdklabs.projen.build.BuildWorkflow |
The PR build GitHub workflow. |
buildWorkflowJobId |
java.lang.String |
The job ID of the build workflow. |
jest |
io.github.cdklabs.projen.javascript.Jest |
The Jest configuration (if enabled). |
maxNodeVersion |
java.lang.String |
Maximum node version required by this package. |
minNodeVersion |
java.lang.String |
Minimum node.js version required by this package. |
npmignore |
io.github.cdklabs.projen.IgnoreFile |
The .npmignore file. |
prettier |
io.github.cdklabs.projen.javascript.Prettier |
No description. |
publisher |
io.github.cdklabs.projen.release.Publisher |
Package publisher. |
release |
io.github.cdklabs.projen.release.Release |
Release management. |
upgradeWorkflow |
io.github.cdklabs.projen.javascript.UpgradeDependencies |
The upgrade workflow. |
apiName |
java.lang.String |
No description. |
definition |
TypeSpecAsyncDefinition |
No description. |
node
Required
public Node getNode();
- Type: software.constructs.Node
The tree node.
buildTask
Required
public Task getBuildTask();
- Type: io.github.cdklabs.projen.Task
commitGenerated
Required
public java.lang.Boolean getCommitGenerated();
- Type: java.lang.Boolean
Whether to commit the managed files by default.
compileTask
Required
public Task getCompileTask();
- Type: io.github.cdklabs.projen.Task
components
Required
public java.util.List<Component> getComponents();
- Type: java.util.List
Returns all the components within this project.
deps
Required
public Dependencies getDeps();
- Type: io.github.cdklabs.projen.Dependencies
Project dependencies.
ejected
Required
public java.lang.Boolean getEjected();
- Type: java.lang.Boolean
Whether or not the project is being ejected.
files
Required
public java.util.List<FileBase> getFiles();
- Type: java.util.List
All files in this project.
gitattributes
Required
public GitAttributesFile getGitattributes();
- Type: io.github.cdklabs.projen.GitAttributesFile
The .gitattributes file for this repository.
gitignore
Required
public IgnoreFile getGitignore();
- Type: io.github.cdklabs.projen.IgnoreFile
.gitignore.
logger
Required
public Logger getLogger();
- Type: io.github.cdklabs.projen.Logger
Logging utilities.
name
Required
public java.lang.String getName();
- Type: java.lang.String
Project name.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
Absolute output directory of this project.
packageTask
Required
public Task getPackageTask();
- Type: io.github.cdklabs.projen.Task
postCompileTask
Required
public Task getPostCompileTask();
- Type: io.github.cdklabs.projen.Task
preCompileTask
Required
public Task getPreCompileTask();
- Type: io.github.cdklabs.projen.Task
projectBuild
Required
public ProjectBuild getProjectBuild();
- Type: io.github.cdklabs.projen.ProjectBuild
Manages the build process of the project.
projenCommand
Required
public java.lang.String getProjenCommand();
- Type: java.lang.String
The command to use in order to run the projen CLI.
root
Required
public Project getRoot();
- Type: io.github.cdklabs.projen.Project
The root project.
subprojects
Required
public java.util.List<Project> getSubprojects();
- Type: java.util.List
Returns all the subprojects within this project.
tasks
Required
public Tasks getTasks();
- Type: io.github.cdklabs.projen.Tasks
Project tasks.
testTask
Required
public Task getTestTask();
- Type: io.github.cdklabs.projen.Task
defaultTask
Optional
public Task getDefaultTask();
- Type: io.github.cdklabs.projen.Task
This is the "default" task, the one that executes "projen".
Undefined if the project is being ejected.
initProject
Optional
public InitProject getInitProject();
- Type: io.github.cdklabs.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.
parent
Optional
public Project getParent();
- Type: io.github.cdklabs.projen.Project
A parent project.
If undefined, this is the root project.
projectType
Required
public ProjectType getProjectType();
- Type: io.github.cdklabs.projen.ProjectType
autoApprove
Optional
public AutoApprove getAutoApprove();
- Type: io.github.cdklabs.projen.github.AutoApprove
Auto approve set up for this project.
devContainer
Optional
public DevContainer getDevContainer();
- Type: io.github.cdklabs.projen.vscode.DevContainer
Access for .devcontainer.json (used for GitHub Codespaces).
This will be undefined
if devContainer boolean is false
github
Optional
public GitHub getGithub();
- Type: io.github.cdklabs.projen.github.GitHub
Access all github components.
This will be undefined
for subprojects.
gitpod
Optional
public Gitpod getGitpod();
- Type: io.github.cdklabs.projen.Gitpod
Access for Gitpod.
This will be undefined
if gitpod boolean is false
vscode
Optional
public VsCode getVscode();
- Type: io.github.cdklabs.projen.vscode.VsCode
Access all VSCode components.
This will be undefined
for subprojects.
~~allowLibraryDependencies
~~Required
- Deprecated: use
package.allowLibraryDependencies
public java.lang.Boolean getAllowLibraryDependencies();
- Type: java.lang.Boolean
artifactsDirectory
Required
public java.lang.String getArtifactsDirectory();
- Type: java.lang.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
.
artifactsJavascriptDirectory
Required
public java.lang.String getArtifactsJavascriptDirectory();
- Type: java.lang.String
The location of the npm tarball after build (${artifactsDirectory}/js
).
bundler
Required
public Bundler getBundler();
- Type: io.github.cdklabs.projen.javascript.Bundler
~~entrypoint
~~Required
- Deprecated: use
package.entrypoint
public java.lang.String getEntrypoint();
- Type: java.lang.String
~~manifest
~~Required
- Deprecated: use
package.addField(x, y)
public java.lang.Object getManifest();
- Type: java.lang.Object
npmrc
Required
public NpmConfig getNpmrc();
- Type: io.github.cdklabs.projen.javascript.NpmConfig
The .npmrc file.
package
Required
public NodePackage getPackage();
- Type: io.github.cdklabs.projen.javascript.NodePackage
API for managing the node package.
~~packageManager
~~Required
- Deprecated: use
package.packageManager
public NodePackageManager getPackageManager();
- Type: io.github.cdklabs.projen.javascript.NodePackageManager
The package manager to use.
runScriptCommand
Required
public java.lang.String getRunScriptCommand();
- Type: java.lang.String
The command to use to run scripts (e.g. yarn run
or npm run
depends on the package manager).
autoMerge
Optional
public AutoMerge getAutoMerge();
- Type: io.github.cdklabs.projen.github.AutoMerge
Component that sets up mergify for merging approved pull requests.
buildWorkflow
Optional
public BuildWorkflow getBuildWorkflow();
- Type: io.github.cdklabs.projen.build.BuildWorkflow
The PR build GitHub workflow.
undefined
if buildWorkflow
is disabled.
buildWorkflowJobId
Optional
public java.lang.String getBuildWorkflowJobId();
- Type: java.lang.String
The job ID of the build workflow.
jest
Optional
public Jest getJest();
- Type: io.github.cdklabs.projen.javascript.Jest
The Jest configuration (if enabled).
maxNodeVersion
Optional
public java.lang.String getMaxNodeVersion();
- Type: java.lang.String
Maximum node version required by this package.
minNodeVersion
Optional
public java.lang.String getMinNodeVersion();
- Type: java.lang.String
Minimum node.js version required by this package.
npmignore
Optional
public IgnoreFile getNpmignore();
- Type: io.github.cdklabs.projen.IgnoreFile
The .npmignore file.
prettier
Optional
public Prettier getPrettier();
- Type: io.github.cdklabs.projen.javascript.Prettier
~~publisher
~~Optional
- Deprecated: use
release.publisher
.
public Publisher getPublisher();
- Type: io.github.cdklabs.projen.release.Publisher
Package publisher.
This will be undefined
if the project does not have a
release workflow.
release
Optional
public Release getRelease();
- Type: io.github.cdklabs.projen.release.Release
Release management.
upgradeWorkflow
Optional
public UpgradeDependencies getUpgradeWorkflow();
- Type: io.github.cdklabs.projen.javascript.UpgradeDependencies
The upgrade workflow.
apiName
Required
public java.lang.String getApiName();
- Type: java.lang.String
definition
Required
public TypeSpecAsyncDefinition getDefinition();
- Type: TypeSpecAsyncDefinition
Constants
Name | Type | Description |
---|---|---|
DEFAULT_TASK |
java.lang.String |
The name of the default task (the task executed when projen is run without arguments). |
DEFAULT_TASK
Required
public java.lang.String getDefaultTask();
- Type: java.lang.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 software.aws.pdk.type_safe_api.TypeSpecDefinition;
TypeSpecDefinition.Builder.create(NodeProject project)
.typeSpecOptions(TypeSpecModelOptions)
// .handlerLanguages(java.util.List<Language>)
.build();
Name | Type | Description |
---|---|---|
project |
io.github.cdklabs.projen.javascript.NodeProject |
No description. |
typeSpecOptions |
TypeSpecModelOptions |
TypeSpec model options. |
handlerLanguages |
java.util.List<Language> |
The languages users have specified for handler projects (if any). |
project
Required
- Type: io.github.cdklabs.projen.javascript.NodeProject
typeSpecOptions
Required
- Type: TypeSpecModelOptions
TypeSpec model options.
handlerLanguages
Optional
- Type: java.util.List<Language>
The languages users have specified for handler projects (if any).
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 java.lang.String toString()
Returns a string representation of this construct.
postSynthesize
public void postSynthesize()
Called after synthesis.
Order is not guaranteed.
preSynthesize
public void preSynthesize()
Called before synthesis.
synthesize
public void synthesize()
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 software.aws.pdk.type_safe_api.TypeSpecDefinition;
TypeSpecDefinition.isConstruct(<