@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-14T16:25:30.692Z") public class Project extends Resource implements IProject
Example:
Bucket bucket; Project project = Project.Builder.create(this, "MyProject") .buildSpec(BuildSpec.fromObject(Map.of( "version", "0.2"))) .artifacts(Artifacts.s3(S3ArtifactsProps.builder() .bucket(bucket) .includeBuildId(false) .packageZip(true) .path("another/path") .identifier("AddArtifact1") .build())) .build();
Modifier and Type | Class and Description |
---|---|
static class |
Project.Builder
A fluent builder for
Project . |
IProject.Jsii$Default, IProject.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
Project(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Project(software.amazon.jsii.JsiiObjectRef objRef) |
|
Project(software.constructs.Construct scope,
java.lang.String id,
ProjectProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addFileSystemLocation(IFileSystemLocation fileSystemLocation)
Adds a fileSystemLocation to the Project.
|
void |
addSecondaryArtifact(IArtifacts secondaryArtifact)
Adds a secondary artifact to the Project.
|
void |
addSecondarySource(ISource secondarySource)
Adds a secondary source to the Project.
|
void |
addToRolePolicy(PolicyStatement statement)
Add a permission only if there's a policy attached.
|
NotificationRuleSourceConfig |
bindAsNotificationRuleSource(software.constructs.Construct _scope)
Returns a source configuration for notification rule.
|
void |
bindToCodePipeline(Construct _scope,
BindToCodePipelineOptions options)
A callback invoked when the given project is added to a CodePipeline.
|
BatchBuildConfig |
enableBatchBuilds()
Enable batch builds.
|
static IProject |
fromProjectArn(software.constructs.Construct scope,
java.lang.String id,
java.lang.String projectArn) |
static IProject |
fromProjectName(software.constructs.Construct scope,
java.lang.String id,
java.lang.String projectName)
Import a Project defined either outside the CDK, or in a different CDK Stack (and exported using the
export method). |
Connections |
getConnections()
Access the Connections object.
|
IPrincipal |
getGrantPrincipal()
The principal to grant permissions to.
|
java.lang.String |
getProjectArn()
The ARN of the project.
|
java.lang.String |
getProjectName()
The name of the project.
|
IRole |
getRole()
The IAM role for this project.
|
Metric |
metric(java.lang.String metricName) |
Metric |
metric(java.lang.String metricName,
MetricOptions props) |
Metric |
metricBuilds()
Measures the number of builds triggered.
|
Metric |
metricBuilds(MetricOptions props)
Measures the number of builds triggered.
|
Metric |
metricDuration()
Measures the duration of all builds over time.
|
Metric |
metricDuration(MetricOptions props)
Measures the duration of all builds over time.
|
Metric |
metricFailedBuilds()
Measures the number of builds that failed because of client error or because of a timeout.
|
Metric |
metricFailedBuilds(MetricOptions props)
Measures the number of builds that failed because of client error or because of a timeout.
|
Metric |
metricSucceededBuilds()
Measures the number of successful builds.
|
Metric |
metricSucceededBuilds(MetricOptions props)
Measures the number of successful builds.
|
INotificationRule |
notifyOn(java.lang.String id,
INotificationRuleTarget target,
ProjectNotifyOnOptions options)
Defines a CodeStar Notification rule triggered when the project events emitted by you specified, it very similar to `onEvent` API.
|
INotificationRule |
notifyOnBuildFailed(java.lang.String id,
INotificationRuleTarget target)
Defines a CodeStar notification rule which triggers when a build fails.
|
INotificationRule |
notifyOnBuildFailed(java.lang.String id,
INotificationRuleTarget target,
NotificationRuleOptions options)
Defines a CodeStar notification rule which triggers when a build fails.
|
INotificationRule |
notifyOnBuildSucceeded(java.lang.String id,
INotificationRuleTarget target)
Defines a CodeStar notification rule which triggers when a build completes successfully.
|
INotificationRule |
notifyOnBuildSucceeded(java.lang.String id,
INotificationRuleTarget target,
NotificationRuleOptions options)
Defines a CodeStar notification rule which triggers when a build completes successfully.
|
Rule |
onBuildFailed(java.lang.String id)
Defines an event rule which triggers when a build fails.
|
Rule |
onBuildFailed(java.lang.String id,
OnEventOptions options)
Defines an event rule which triggers when a build fails.
|
Rule |
onBuildStarted(java.lang.String id)
Defines an event rule which triggers when a build starts.
|
Rule |
onBuildStarted(java.lang.String id,
OnEventOptions options)
Defines an event rule which triggers when a build starts.
|
Rule |
onBuildSucceeded(java.lang.String id)
Defines an event rule which triggers when a build completes successfully.
|
Rule |
onBuildSucceeded(java.lang.String id,
OnEventOptions options)
Defines an event rule which triggers when a build completes successfully.
|
Rule |
onEvent(java.lang.String id)
Defines a CloudWatch event rule triggered when something happens with this project.
|
Rule |
onEvent(java.lang.String id,
OnEventOptions options)
Defines a CloudWatch event rule triggered when something happens with this project.
|
Rule |
onPhaseChange(java.lang.String id)
Defines a CloudWatch event rule that triggers upon phase change of this build project.
|
Rule |
onPhaseChange(java.lang.String id,
OnEventOptions options)
Defines a CloudWatch event rule that triggers upon phase change of this build project.
|
Rule |
onStateChange(java.lang.String id)
Defines a CloudWatch event rule triggered when the build project state changes.
|
Rule |
onStateChange(java.lang.String id,
OnEventOptions options)
Defines a CloudWatch event rule triggered when the build project state changes.
|
static java.util.List<CfnProject.EnvironmentVariableProperty> |
serializeEnvVariables(java.util.Map<java.lang.String,? extends BuildEnvironmentVariable> environmentVariables)
Convert the environment variables map of string to
BuildEnvironmentVariable , which is the customer-facing type, to a list of CfnProject.EnvironmentVariableProperty , which is the representation of environment variables in CloudFormation. |
static java.util.List<CfnProject.EnvironmentVariableProperty> |
serializeEnvVariables(java.util.Map<java.lang.String,? extends BuildEnvironmentVariable> environmentVariables,
java.lang.Boolean validateNoPlainTextSecrets)
Convert the environment variables map of string to
BuildEnvironmentVariable , which is the customer-facing type, to a list of CfnProject.EnvironmentVariableProperty , which is the representation of environment variables in CloudFormation. |
static java.util.List<CfnProject.EnvironmentVariableProperty> |
serializeEnvVariables(java.util.Map<java.lang.String,? extends BuildEnvironmentVariable> environmentVariables,
java.lang.Boolean validateNoPlainTextSecrets,
IGrantable principal)
Convert the environment variables map of string to
BuildEnvironmentVariable , which is the customer-facing type, to a list of CfnProject.EnvironmentVariableProperty , which is the representation of environment variables in CloudFormation. |
protected java.util.List<java.lang.String> |
validate()
Validate the current construct.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected Project(software.amazon.jsii.JsiiObjectRef objRef)
protected Project(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Project(software.constructs.Construct scope, java.lang.String id, ProjectProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IProject fromProjectArn(software.constructs.Construct scope, java.lang.String id, java.lang.String projectArn)
scope
- This parameter is required.id
- This parameter is required.projectArn
- This parameter is required.public static IProject fromProjectName(software.constructs.Construct scope, java.lang.String id, java.lang.String projectName)
export
method).
scope
- the parent Construct for this Construct. This parameter is required.id
- the logical name of this Construct. This parameter is required.projectName
- the name of the project to import. This parameter is required.public static java.util.List<CfnProject.EnvironmentVariableProperty> serializeEnvVariables(java.util.Map<java.lang.String,? extends BuildEnvironmentVariable> environmentVariables, java.lang.Boolean validateNoPlainTextSecrets, IGrantable principal)
BuildEnvironmentVariable
, which is the customer-facing type, to a list of CfnProject.EnvironmentVariableProperty
, which is the representation of environment variables in CloudFormation.
environmentVariables
- the map of string to environment variables. This parameter is required.validateNoPlainTextSecrets
- whether to throw an exception if any of the plain text environment variables contain secrets, defaults to 'false'.principal
- CfnProject.EnvironmentVariableProperty
instancespublic static java.util.List<CfnProject.EnvironmentVariableProperty> serializeEnvVariables(java.util.Map<java.lang.String,? extends BuildEnvironmentVariable> environmentVariables, java.lang.Boolean validateNoPlainTextSecrets)
BuildEnvironmentVariable
, which is the customer-facing type, to a list of CfnProject.EnvironmentVariableProperty
, which is the representation of environment variables in CloudFormation.
environmentVariables
- the map of string to environment variables. This parameter is required.validateNoPlainTextSecrets
- whether to throw an exception if any of the plain text environment variables contain secrets, defaults to 'false'.CfnProject.EnvironmentVariableProperty
instancespublic static java.util.List<CfnProject.EnvironmentVariableProperty> serializeEnvVariables(java.util.Map<java.lang.String,? extends BuildEnvironmentVariable> environmentVariables)
BuildEnvironmentVariable
, which is the customer-facing type, to a list of CfnProject.EnvironmentVariableProperty
, which is the representation of environment variables in CloudFormation.
environmentVariables
- the map of string to environment variables. This parameter is required.CfnProject.EnvironmentVariableProperty
instancespublic void addFileSystemLocation(IFileSystemLocation fileSystemLocation)
fileSystemLocation
- the fileSystemLocation to add. This parameter is required.public void addSecondaryArtifact(IArtifacts secondaryArtifact)
secondaryArtifact
- the artifact to add as a secondary artifact. This parameter is required.public void addSecondarySource(ISource secondarySource)
secondarySource
- the source to add as a secondary source. This parameter is required.public void addToRolePolicy(PolicyStatement statement)
addToRolePolicy
in interface IProject
statement
- The permissions statement to add. This parameter is required.public NotificationRuleSourceConfig bindAsNotificationRuleSource(software.constructs.Construct _scope)
bindAsNotificationRuleSource
in interface INotificationRuleSource
_scope
- This parameter is required.public void bindToCodePipeline(Construct _scope, BindToCodePipelineOptions options)
_scope
- the construct the binding is taking place in. This parameter is required.options
- additional options for the binding. This parameter is required.public BatchBuildConfig enableBatchBuilds()
Returns an object contining the batch service role if batch builds could be enabled.
enableBatchBuilds
in interface IProject
public Metric metric(java.lang.String metricName, MetricOptions props)
public Metric metric(java.lang.String metricName)
public Metric metricBuilds(MetricOptions props)
Units: Count
Valid CloudWatch statistics: Sum
Default: sum over 5 minutes
metricBuilds
in interface IProject
props
- public Metric metricBuilds()
Units: Count
Valid CloudWatch statistics: Sum
Default: sum over 5 minutes
metricBuilds
in interface IProject
public Metric metricDuration(MetricOptions props)
Units: Seconds
Valid CloudWatch statistics: Average (recommended), Maximum, Minimum
Default: average over 5 minutes
metricDuration
in interface IProject
props
- public Metric metricDuration()
Units: Seconds
Valid CloudWatch statistics: Average (recommended), Maximum, Minimum
Default: average over 5 minutes
metricDuration
in interface IProject
public Metric metricFailedBuilds(MetricOptions props)
Units: Count
Valid CloudWatch statistics: Sum
Default: sum over 5 minutes
metricFailedBuilds
in interface IProject
props
- public Metric metricFailedBuilds()
Units: Count
Valid CloudWatch statistics: Sum
Default: sum over 5 minutes
metricFailedBuilds
in interface IProject
public Metric metricSucceededBuilds(MetricOptions props)
Units: Count
Valid CloudWatch statistics: Sum
Default: sum over 5 minutes
metricSucceededBuilds
in interface IProject
props
- public Metric metricSucceededBuilds()
Units: Count
Valid CloudWatch statistics: Sum
Default: sum over 5 minutes
metricSucceededBuilds
in interface IProject
public INotificationRule notifyOn(java.lang.String id, INotificationRuleTarget target, ProjectNotifyOnOptions options)
You can also use the methods notifyOnBuildSucceeded
and
notifyOnBuildFailed
to define rules for these specific event emitted.
public INotificationRule notifyOnBuildFailed(java.lang.String id, INotificationRuleTarget target, NotificationRuleOptions options)
notifyOnBuildFailed
in interface IProject
id
- This parameter is required.target
- This parameter is required.options
- public INotificationRule notifyOnBuildFailed(java.lang.String id, INotificationRuleTarget target)
notifyOnBuildFailed
in interface IProject
id
- This parameter is required.target
- This parameter is required.public INotificationRule notifyOnBuildSucceeded(java.lang.String id, INotificationRuleTarget target, NotificationRuleOptions options)
notifyOnBuildSucceeded
in interface IProject
id
- This parameter is required.target
- This parameter is required.options
- public INotificationRule notifyOnBuildSucceeded(java.lang.String id, INotificationRuleTarget target)
notifyOnBuildSucceeded
in interface IProject
id
- This parameter is required.target
- This parameter is required.public Rule onBuildFailed(java.lang.String id, OnEventOptions options)
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onBuildFailed
in interface IProject
id
- This parameter is required.options
- public Rule onBuildFailed(java.lang.String id)
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onBuildFailed
in interface IProject
id
- This parameter is required.public Rule onBuildStarted(java.lang.String id, OnEventOptions options)
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onBuildStarted
in interface IProject
id
- This parameter is required.options
- public Rule onBuildStarted(java.lang.String id)
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onBuildStarted
in interface IProject
id
- This parameter is required.public Rule onBuildSucceeded(java.lang.String id, OnEventOptions options)
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onBuildSucceeded
in interface IProject
id
- This parameter is required.options
- public Rule onBuildSucceeded(java.lang.String id)
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onBuildSucceeded
in interface IProject
id
- This parameter is required.public Rule onEvent(java.lang.String id, OnEventOptions options)
onEvent
in interface IProject
id
- This parameter is required.options
- public Rule onEvent(java.lang.String id)
onEvent
in interface IProject
id
- This parameter is required.public Rule onPhaseChange(java.lang.String id, OnEventOptions options)
onPhaseChange
in interface IProject
id
- This parameter is required.options
- public Rule onPhaseChange(java.lang.String id)
onPhaseChange
in interface IProject
id
- This parameter is required.public Rule onStateChange(java.lang.String id, OnEventOptions options)
You can filter specific build status events using an event
pattern filter on the build-status
detail field:
const rule = project.onStateChange('OnBuildStarted', { target }); rule.addEventPattern({ detail: { 'build-status': [ "IN_PROGRESS", "SUCCEEDED", "FAILED", "STOPPED" ] } });
You can also use the methods onBuildFailed
and onBuildSucceeded
to define rules for
these specific state changes.
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onStateChange
in interface IProject
id
- This parameter is required.options
- public Rule onStateChange(java.lang.String id)
You can filter specific build status events using an event
pattern filter on the build-status
detail field:
const rule = project.onStateChange('OnBuildStarted', { target }); rule.addEventPattern({ detail: { 'build-status': [ "IN_PROGRESS", "SUCCEEDED", "FAILED", "STOPPED" ] } });
You can also use the methods onBuildFailed
and onBuildSucceeded
to define rules for
these specific state changes.
To access fields from the event in the event target input,
use the static fields on the StateChangeEvent
class.
onStateChange
in interface IProject
id
- This parameter is required.protected java.util.List<java.lang.String> validate()
This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.
public Connections getConnections()
Will fail if this Project does not have a VPC set.
getConnections
in interface IConnectable
public IPrincipal getGrantPrincipal()
getGrantPrincipal
in interface IGrantable
public java.lang.String getProjectArn()
getProjectArn
in interface IProject
public java.lang.String getProjectName()
getProjectName
in interface IProject