IProject Interface
Properties
connectionsConnectionsconnectionsConnectionsconnectionsConnectionsConnectionsConnectionsConnectionsConnectionsrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#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#projectRefProjectReferenceproject_refProjectReferenceprojectRefProjectReferenceProjectRefProjectReferenceProjectRefProjectReferencerequired#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)#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#enableBatchBuilds(): BatchBuildConfigdef enable_batch_builds(self, ) -> BatchBuildConfigpublic BatchBuildConfig enableBatchBuilds()public BatchBuildConfig EnableBatchBuilds()func EnableBatchBuilds() BatchBuildConfig#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#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#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#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#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#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#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#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#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#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#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#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#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#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#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