Skip to content
v2.274.0

IProject Interface ​

Properties ​

connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#
The network connections associated with this resource.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

grantPrincipalIPrincipalgrant_principalIPrincipalgrantPrincipalIPrincipalGrantPrincipalIPrincipalGrantPrincipalIPrincipalrequired#
The principal to grant permissions to.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
projectArnstringproject_arnstrprojectArnStringProjectArnstringProjectArn*stringrequired#
The ARN of this Project.
projectNamestringproject_namestrprojectNameStringProjectNamestringProjectName*stringrequired#
The human-visible name of this Project.
projectRefProjectReferenceproject_refProjectReferenceprojectRefProjectReferenceProjectRefProjectReferenceProjectRefProjectReferencerequired#
A reference to a Project resource.
rolemay be undefinedIRolerolemay be undefinedIRolerolemay be undefinedIRoleRolemay be undefinedIRoleRolemay be undefinedIRole#
The IAM service Role of this Project.

Undefined for imported Projects.

stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.

Methods ​

addToRolePolicy(policyStatement: PolicyStatement): voiddef add_to_role_policy(self, policy_statement: PolicyStatement) -> Nonepublic void addToRolePolicy(PolicyStatement policyStatement)public void AddToRolePolicy(PolicyStatement policyStatement)func AddToRolePolicy(PolicyStatement PolicyStatement)#
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

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).

bindAsNotificationRuleSource(scope: Construct): NotificationRuleSourceConfigdef bind_as_notification_rule_source(self, scope: Construct) -> NotificationRuleSourceConfigpublic NotificationRuleSourceConfig bindAsNotificationRuleSource(Construct scope)public NotificationRuleSourceConfig BindAsNotificationRuleSource(Construct scope)func BindAsNotificationRuleSource(Scope Construct) NotificationRuleSourceConfig#
Returns a source configuration for notification rule.
enableBatchBuilds(): BatchBuildConfigdef enable_batch_builds(self, ) -> BatchBuildConfigpublic BatchBuildConfig enableBatchBuilds()public BatchBuildConfig EnableBatchBuilds()func EnableBatchBuilds() BatchBuildConfig#
Enable batch builds.

Returns an object contining the batch service role if batch builds could be enabled.

metric(metricName: string, props?: MetricOptions): Metricdef metric(self, metric_name: str, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metric(String metricName, MetricOptions props)public Metric Metric(string metricName, MetricOptions? props = null)func Metric(MetricName *string, Props MetricOptions) Metric#
2 parameters · returns

Parameters

  • metricNamemetric_namemetricNamemetricNameMetricName — The name of the metric.
  • propspropspropspropsProps — Customization properties.

Returns: a CloudWatch metric associated with this build project.

metricBuilds(props?: MetricOptions): Metricdef metric_builds(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricBuilds(MetricOptions props)public Metric MetricBuilds(MetricOptions? props = null)func MetricBuilds(Props MetricOptions) Metric#
Measures the number of builds triggered.

Units: Count

Valid CloudWatch statistics: Sum

metricDuration(props?: MetricOptions): Metricdef metric_duration(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricDuration(MetricOptions props)public Metric MetricDuration(MetricOptions? props = null)func MetricDuration(Props MetricOptions) Metric#
Measures the duration of all builds over time.

Units: Seconds

Valid CloudWatch statistics: Average (recommended), Maximum, Minimum

metricFailedBuilds(props?: MetricOptions): Metricdef metric_failed_builds(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricFailedBuilds(MetricOptions props)public Metric MetricFailedBuilds(MetricOptions? props = null)func MetricFailedBuilds(Props MetricOptions) Metric#
Measures the number of builds that failed because of client error or because of a timeout.

Units: Count

Valid CloudWatch statistics: Sum

metricSucceededBuilds(props?: MetricOptions): Metricdef metric_succeeded_builds(self, props: typing.Optional[MetricOptions] = None) -> Metricpublic Metric metricSucceededBuilds(MetricOptions props)public Metric MetricSucceededBuilds(MetricOptions? props = null)func MetricSucceededBuilds(Props MetricOptions) Metric#
Measures the number of successful builds.

Units: Count

Valid CloudWatch statistics: Sum

notifyOn(id: string, target: INotificationRuleTarget, options: ProjectNotifyOnOptions): INotificationRuledef notify_on(self, id: str, target: INotificationRuleTarget, options: ProjectNotifyOnOptions) -> INotificationRulepublic INotificationRule notifyOn(String id, INotificationRuleTarget target, ProjectNotifyOnOptions options)public INotificationRule NotifyOn(string id, INotificationRuleTarget target, ProjectNotifyOnOptions options)func NotifyOn(Id *string, Target INotificationRuleTarget, Options ProjectNotifyOnOptions) INotificationRule#
Defines a CodeStar Notification rule triggered when the project events emitted by you specified, it very similar to `onEvent` API.

You can also use the methods notifyOnBuildSucceeded and notifyOnBuildFailed to define rules for these specific event emitted.

3 parameters · returns

Parameters

  • ididididId — The logical identifier of the CodeStar Notifications rule that will be created.
  • targettargettargettargetTarget — The target to register for the CodeStar Notifications destination.
  • optionsoptionsoptionsoptionsOptions — Customization options for CodeStar Notifications rule.

Returns: CodeStar Notifications rule associated with this build project.

notifyOnBuildFailed(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_build_failed(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnBuildFailed(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnBuildFailed(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnBuildFailed(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#
Defines a CodeStar notification rule which triggers when a build fails.
notifyOnBuildSucceeded(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_build_succeeded(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnBuildSucceeded(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnBuildSucceeded(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnBuildSucceeded(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#
Defines a CodeStar notification rule which triggers when a build completes successfully.
onBuildFailed(id: string, options?: OnEventOptions): Ruledef on_build_failed(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onBuildFailed(String id, OnEventOptions options)public Rule OnBuildFailed(string id, OnEventOptions? options = null)func OnBuildFailed(Id *string, Options OnEventOptions) Rule#
Defines an event rule which triggers when a build fails.
onBuildStarted(id: string, options?: OnEventOptions): Ruledef on_build_started(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onBuildStarted(String id, OnEventOptions options)public Rule OnBuildStarted(string id, OnEventOptions? options = null)func OnBuildStarted(Id *string, Options OnEventOptions) Rule#
Defines an event rule which triggers when a build starts.
onBuildSucceeded(id: string, options?: OnEventOptions): Ruledef on_build_succeeded(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onBuildSucceeded(String id, OnEventOptions options)public Rule OnBuildSucceeded(string id, OnEventOptions? options = null)func OnBuildSucceeded(Id *string, Options OnEventOptions) Rule#
Defines an event rule which triggers when a build completes successfully.
onEvent(id: string, options?: OnEventOptions): Ruledef on_event(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onEvent(String id, OnEventOptions options)public Rule OnEvent(string id, OnEventOptions? options = null)func OnEvent(Id *string, Options OnEventOptions) Rule#
Defines a CloudWatch event rule triggered when something happens with this project.
onPhaseChange(id: string, options?: OnEventOptions): Ruledef on_phase_change(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onPhaseChange(String id, OnEventOptions options)public Rule OnPhaseChange(string id, OnEventOptions? options = null)func OnPhaseChange(Id *string, Options OnEventOptions) Rule#
Defines a CloudWatch event rule that triggers upon phase change of this build project.
onStateChange(id: string, options?: OnEventOptions): Ruledef on_state_change(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onStateChange(String id, OnEventOptions options)public Rule OnStateChange(string id, OnEventOptions? options = null)func OnStateChange(Id *string, Options OnEventOptions) Rule#
Defines a CloudWatch event rule triggered when the build project state changes.
notes

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.

with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining