Project
- class aws_cdk.aws_codebuild.Project(scope, id, *, artifacts=None, secondary_artifacts=None, secondary_sources=None, source=None, allow_all_outbound=None, badge=None, build_spec=None, cache=None, check_secrets_in_plain_text_env_variables=None, concurrent_build_limit=None, description=None, encryption_key=None, environment=None, environment_variables=None, file_system_locations=None, grant_report_group_permissions=None, logging=None, project_name=None, queued_timeout=None, role=None, security_groups=None, subnet_selection=None, timeout=None, vpc=None)
Bases:
Resource
A representation of a CodeBuild Project.
- ExampleMetadata:
infused
Example:
# bucket: s3.Bucket project = codebuild.Project(self, "MyProject", build_spec=codebuild.BuildSpec.from_object({ "version": "0.2" }), artifacts=codebuild.Artifacts.s3( bucket=bucket, include_build_id=False, package_zip=True, path="another/path", identifier="AddArtifact1" ) )
- Parameters:
scope (
Construct
) –id (
str
) –artifacts (
Optional
[IArtifacts
]) – Defines where build artifacts will be stored. Could be: PipelineBuildArtifacts, NoArtifacts and S3Artifacts. Default: NoArtifactssecondary_artifacts (
Optional
[Sequence
[IArtifacts
]]) – The secondary artifacts for the Project. Can also be added after the Project has been created by using the {@link Project#addSecondaryArtifact} method. Default: - No secondary artifacts.secondary_sources (
Optional
[Sequence
[ISource
]]) – The secondary sources for the Project. Can be also added after the Project has been created by using the {@link Project#addSecondarySource} method. Default: - No secondary sources.source (
Optional
[ISource
]) – The source of the build. Note: if {@link NoSource} is given as the source, then you need to provide an explicitbuildSpec
. Default: - NoSourceallow_all_outbound (
Optional
[bool
]) – Whether to allow the CodeBuild to send all network traffic. If set to false, you must individually add traffic rules to allow the CodeBuild project to connect to network targets. Only used if ‘vpc’ is supplied. Default: truebadge (
Optional
[bool
]) – Indicates whether AWS CodeBuild generates a publicly accessible URL for your project’s build badge. For more information, see Build Badges Sample in the AWS CodeBuild User Guide. Default: falsebuild_spec (
Optional
[BuildSpec
]) – Filename or contents of buildspec in JSON format. Default: - Empty buildspec.cache (
Optional
[Cache
]) – Caching strategy to use. Default: Cache.nonecheck_secrets_in_plain_text_env_variables (
Optional
[bool
]) – Whether to check for the presence of any secrets in the environment variables of the default type, BuildEnvironmentVariableType.PLAINTEXT. Since using a secret for the value of that kind of variable would result in it being displayed in plain text in the AWS Console, the construct will throw an exception if it detects a secret was passed there. Pass this property as false if you want to skip this validation, and keep using a secret in a plain text environment variable. Default: trueconcurrent_build_limit (
Union
[int
,float
,None
]) – Maximum number of concurrent builds. Minimum value is 1 and maximum is account build limit. Default: - no explicit limit is setdescription (
Optional
[str
]) – A description of the project. Use the description to identify the purpose of the project. Default: - No description.encryption_key (
Optional
[IKey
]) – Encryption key to use to read and write artifacts. Default: - The AWS-managed CMK for Amazon Simple Storage Service (Amazon S3) is used.environment (
Union
[BuildEnvironment
,Dict
[str
,Any
],None
]) – Build environment to use for the build. Default: BuildEnvironment.LinuxBuildImage.STANDARD_1_0environment_variables (
Optional
[Mapping
[str
,Union
[BuildEnvironmentVariable
,Dict
[str
,Any
]]]]) – Additional environment variables to add to the build environment. Default: - No additional environment variables are specified.file_system_locations (
Optional
[Sequence
[IFileSystemLocation
]]) – An ProjectFileSystemLocation objects for a CodeBuild build project. A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, and type of a file system created using Amazon Elastic File System. Default: - no file system locationsgrant_report_group_permissions (
Optional
[bool
]) – Add permissions to this project’s role to create and use test report groups with name starting with the name of this project. That is the standard report group that gets created when a simple name (in contrast to an ARN) is used in the ‘reports’ section of the buildspec of this project. This is usually harmless, but you can turn these off if you don’t plan on using test reports in this project. Default: truelogging (
Union
[LoggingOptions
,Dict
[str
,Any
],None
]) – Information about logs for the build project. A project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both. Default: - no log configuration is setproject_name (
Optional
[str
]) – The physical, human-readable name of the CodeBuild Project. Default: - Name is automatically generated.queued_timeout (
Optional
[Duration
]) – The number of minutes after which AWS CodeBuild stops the build if it’s still in queue. For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide. Default: - no queue timeout is setrole (
Optional
[IRole
]) – Service Role to assume while running the build. Default: - A role will be created.security_groups (
Optional
[Sequence
[ISecurityGroup
]]) – What security group to associate with the codebuild project’s network interfaces. If no security group is identified, one will be created automatically. Only used if ‘vpc’ is supplied. Default: - Security group will be automatically created.subnet_selection (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Where to place the network interfaces within the VPC. Only used if ‘vpc’ is supplied. Default: - All private subnets.timeout (
Optional
[Duration
]) – The number of minutes after which AWS CodeBuild stops the build if it’s not complete. For valid values, see the timeoutInMinutes field in the AWS CodeBuild User Guide. Default: Duration.hours(1)vpc (
Optional
[IVpc
]) – VPC network to place codebuild network interfaces. Specify this if the codebuild project needs to access resources in a VPC. Default: - No VPC is specified.
Methods
- add_file_system_location(file_system_location)
Adds a fileSystemLocation to the Project.
- Parameters:
file_system_location (
IFileSystemLocation
) – the fileSystemLocation to add.- Return type:
None
- add_secondary_artifact(secondary_artifact)
Adds a secondary artifact to the Project.
- Parameters:
secondary_artifact (
IArtifacts
) – the artifact to add as a secondary artifact.- See:
https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html
- Return type:
None
- add_secondary_source(secondary_source)
Adds a secondary source to the Project.
- Parameters:
secondary_source (
ISource
) – the source to add as a secondary source.- See:
https://docs.aws.amazon.com/codebuild/latest/userguide/sample-multi-in-out.html
- Return type:
None
- add_to_role_policy(statement)
Add a permission only if there’s a policy attached.
- Parameters:
statement (
PolicyStatement
) – The permissions statement to add.- Return type:
None
- apply_removal_policy(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
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- bind_as_notification_rule_source(_scope)
Returns a source configuration for notification rule.
- Parameters:
_scope (
Construct
) –- Return type:
- bind_to_code_pipeline(_scope, *, artifact_bucket)
A callback invoked when the given project is added to a CodePipeline.
- enable_batch_builds()
Enable batch builds.
Returns an object contining the batch service role if batch builds could be enabled.
- Return type:
Optional
[BatchBuildConfig
]
- metric(metric_name, *, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
- Parameters:
metric_name (
str
) – The name of the metric.account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions (
Optional
[Mapping
[str
,Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.dimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) – Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No labelperiod (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Return type:
- Returns:
a CloudWatch metric associated with this build project.
- metric_builds(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
Measures the number of builds triggered.
Units: Count
Valid CloudWatch statistics: Sum
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions (
Optional
[Mapping
[str
,Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.dimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Default:
sum over 5 minutes
- Return type:
- metric_duration(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
Measures the duration of all builds over time.
Units: Seconds
Valid CloudWatch statistics: Average (recommended), Maximum, Minimum
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions (
Optional
[Mapping
[str
,Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.dimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Default:
average over 5 minutes
- Return type:
- metric_failed_builds(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
Measures the number of builds that failed because of client error or because of a timeout.
Units: Count
Valid CloudWatch statistics: Sum
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions (
Optional
[Mapping
[str
,Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.dimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Default:
sum over 5 minutes
- Return type:
- metric_succeeded_builds(*, account=None, color=None, dimensions=None, dimensions_map=None, label=None, period=None, region=None, statistic=None, unit=None)
Measures the number of successful builds.
Units: Count
Valid CloudWatch statistics: Sum
- Parameters:
account (
Optional
[str
]) – Account which this metric comes from. Default: - Deployment account.color (
Optional
[str
]) – The hex color code, prefixed with ‘#’ (e.g. ‘#00ff00’), to use when this metric is rendered on a graph. TheColor
class has a set of standard colors that can be used here. Default: - Automatic colordimensions (
Optional
[Mapping
[str
,Any
]]) – (deprecated) Dimensions of the metric. Default: - No dimensions.dimensions_map (
Optional
[Mapping
[str
,str
]]) – Dimensions of the metric. Default: - No dimensions.label (
Optional
[str
]) –Label for this metric when added to a Graph in a Dashboard. You can use dynamic labels to show summary information about the entire displayed time series in the legend. For example, if you use:: [max: ${MAX}] MyMetric As the metric label, the maximum value in the visible range will be shown next to the time series name in the graph’s legend. Default: - No label
period (
Optional
[Duration
]) – The period over which the specified statistic is applied. Default: Duration.minutes(5)region (
Optional
[str
]) – Region which this metric comes from. Default: - Deployment region.statistic (
Optional
[str
]) – What function to use for aggregating. Can be one of the following: - “Minimum” | “min” - “Maximum” | “max” - “Average” | “avg” - “Sum” | “sum” - “SampleCount | “n” - “pNN.NN” Default: Averageunit (
Optional
[Unit
]) – Unit used to filter the metric stream. Only refer to datums emitted to the metric stream with the given unit and ignore all others. Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
- Default:
sum over 5 minutes
- Return type:
- notify_on(id, target, *, events, detail_type=None, enabled=None, notification_rule_name=None)
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
andnotifyOnBuildFailed
to define rules for these specific event emitted.- Parameters:
id (
str
) –target (
INotificationRuleTarget
) –events (
Sequence
[ProjectNotificationEvents
]) – A list of event types associated with this notification rule for CodeBuild Project. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.detail_type (
Optional
[DetailType
]) – The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. Default: DetailType.FULLenabled (
Optional
[bool
]) – The status of the notification rule. If the enabled is set to DISABLED, notifications aren’t sent for the notification rule. Default: truenotification_rule_name (
Optional
[str
]) – The name for the notification rule. Notification rule names must be unique in your AWS account. Default: - generated from theid
- Return type:
- notify_on_build_failed(id, target, *, detail_type=None, enabled=None, notification_rule_name=None)
Defines a CodeStar notification rule which triggers when a build fails.
- Parameters:
id (
str
) –target (
INotificationRuleTarget
) –detail_type (
Optional
[DetailType
]) – The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. Default: DetailType.FULLenabled (
Optional
[bool
]) – The status of the notification rule. If the enabled is set to DISABLED, notifications aren’t sent for the notification rule. Default: truenotification_rule_name (
Optional
[str
]) – The name for the notification rule. Notification rule names must be unique in your AWS account. Default: - generated from theid
- Return type:
- notify_on_build_succeeded(id, target, *, detail_type=None, enabled=None, notification_rule_name=None)
Defines a CodeStar notification rule which triggers when a build completes successfully.
- Parameters:
id (
str
) –target (
INotificationRuleTarget
) –detail_type (
Optional
[DetailType
]) – The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in AWS CloudWatch. FULL will include any supplemental information provided by AWS CodeStar Notifications and/or the service for the resource for which the notification is created. Default: DetailType.FULLenabled (
Optional
[bool
]) – The status of the notification rule. If the enabled is set to DISABLED, notifications aren’t sent for the notification rule. Default: truenotification_rule_name (
Optional
[str
]) – The name for the notification rule. Notification rule names must be unique in your AWS account. Default: - generated from theid
- Return type:
- on_build_failed(id, *, description=None, event_pattern=None, rule_name=None, target=None)
Defines an event rule which triggers when a build fails.
To access fields from the event in the event target input, use the static fields on the
StateChangeEvent
class.- Parameters:
id (
str
) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.
- Return type:
- on_build_started(id, *, description=None, event_pattern=None, rule_name=None, target=None)
Defines an event rule which triggers when a build starts.
To access fields from the event in the event target input, use the static fields on the
StateChangeEvent
class.- Parameters:
id (
str
) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.
- Return type:
- on_build_succeeded(id, *, description=None, event_pattern=None, rule_name=None, target=None)
Defines an event rule which triggers when a build completes successfully.
To access fields from the event in the event target input, use the static fields on the
StateChangeEvent
class.- Parameters:
id (
str
) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.
- Return type:
- on_event(id, *, description=None, event_pattern=None, rule_name=None, target=None)
Defines a CloudWatch event rule triggered when something happens with this project.
- Parameters:
id (
str
) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.
- See:
- Return type:
- on_phase_change(id, *, description=None, event_pattern=None, rule_name=None, target=None)
Defines a CloudWatch event rule that triggers upon phase change of this build project.
- Parameters:
id (
str
) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.
- See:
- Return type:
- on_state_change(id, *, description=None, event_pattern=None, rule_name=None, target=None)
Defines a CloudWatch event rule triggered when the build project state changes.
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
andonBuildSucceeded
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.- Parameters:
id (
str
) –description (
Optional
[str
]) – A description of the rule’s purpose. Default: - No descriptionevent_pattern (
Union
[EventPattern
,Dict
[str
,Any
],None
]) – Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering. Default: - No additional filtering based on an event pattern.rule_name (
Optional
[str
]) – A name for the rule. Default: AWS CloudFormation generates a unique physical ID.target (
Optional
[IRuleTarget
]) – The target to register for the event. Default: - No target is added to the rule. UseaddTarget()
to add a target.
- See:
- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- connections
Access the Connections object.
Will fail if this Project does not have a VPC set.
- env
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.
- grant_principal
The principal to grant permissions to.
- node
The construct tree node associated with this construct.
- project_arn
The ARN of the project.
- project_name
The name of the project.
- role
The IAM role for this project.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod from_project_arn(scope, id, project_arn)
- classmethod from_project_name(scope, id, project_name)
Import a Project defined either outside the CDK, or in a different CDK Stack (and exported using the {@link export} method).
- Parameters:
scope (
Construct
) – the parent Construct for this Construct.id (
str
) – the logical name of this Construct.project_name (
str
) – the name of the project to import.
- Return type:
- Returns:
a reference to the existing Project
- Note:
if you’re importing a CodeBuild Project for use in a CodePipeline, make sure the existing Project has permissions to access the S3 Bucket of that Pipeline - otherwise, builds in that Pipeline will always fail.
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod serialize_env_variables(environment_variables, validate_no_plain_text_secrets=None, principal=None)
Convert the environment variables map of string to {@link BuildEnvironmentVariable}, which is the customer-facing type, to a list of {@link CfnProject.EnvironmentVariableProperty}, which is the representation of environment variables in CloudFormation.
- Parameters:
environment_variables (
Mapping
[str
,Union
[BuildEnvironmentVariable
,Dict
[str
,Any
]]]) – the map of string to environment variables.validate_no_plain_text_secrets (
Optional
[bool
]) – whether to throw an exception if any of the plain text environment variables contain secrets, defaults to ‘false’.principal (
Optional
[IGrantable
]) –
- Return type:
- Returns:
an array of {@link CfnProject.EnvironmentVariableProperty} instances