Class: AWSCDK::CodeBuild::Project
- Inherits:
-
Resource
- Object
- Resource
- AWSCDK::CodeBuild::Project
- Includes:
- IProject
- Defined in:
- code_build/project.rb
Overview
A representation of a CodeBuild Project.
Direct Known Subclasses
Class Method Summary collapse
- .from_project_arn(scope, id, project_arn) ⇒ AWSCDK::CodeBuild::IProject
-
.from_project_name(scope, id, project_name) ⇒ AWSCDK::CodeBuild::IProject
Import a Project defined either outside the CDK, or in a different CDK Stack (and exported using the
exportmethod). - .jsii_overridable_methods ⇒ Object
-
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
-
.serialize_env_variables(environment_variables, validate_no_plain_text_secrets = nil, principal = nil) ⇒ Array<AWSCDK::CodeBuild::CfnProject::EnvironmentVariableProperty>
Convert the environment variables map of string to
BuildEnvironmentVariable, which is the customer-facing type, to a list ofCfnProject.EnvironmentVariableProperty, which is the representation of environment variables in CloudFormation.
Instance Method Summary collapse
-
#add_file_system_location(file_system_location) ⇒ void
Adds a fileSystemLocation to the Project.
-
#add_secondary_artifact(secondary_artifact) ⇒ void
Adds a secondary artifact to the Project.
-
#add_secondary_source(secondary_source) ⇒ void
Adds a secondary source to the Project.
-
#add_to_role_policy(statement) ⇒ void
Add a permission only if there's a policy attached.
-
#apply_cross_stack_reference_strength(strength) ⇒ void
Override the cross-stack reference strength for this resource.
-
#apply_removal_policy(policy) ⇒ void
Apply the given removal policy to this resource.
-
#bind_as_notification_rule_source(_scope) ⇒ AWSCDK::CodeStarNotifications::NotificationRuleSourceConfig
Returns a source configuration for notification rule.
-
#bind_to_code_pipeline(_scope, options) ⇒ void
A callback invoked when the given project is added to a CodePipeline.
-
#connections ⇒ AWSCDK::EC2::Connections
Access the Connections object.
-
#enable_batch_builds ⇒ AWSCDK::CodeBuild::BatchBuildConfig?
Enable batch builds.
-
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
- #generate_physical_name ⇒ String
-
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
bucket.bucketArn). -
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
bucket.bucketName). -
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
-
#initialize(scope, id, props) ⇒ Project
constructor
A new instance of Project.
-
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
A CloudWatch metric associated with this build project.
-
#metric_builds(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Measures the number of builds triggered.
-
#metric_duration(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Measures the duration of all builds over time.
-
#metric_failed_builds(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Measures the number of builds that failed because of client error or because of a timeout.
-
#metric_succeeded_builds(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Measures the number of successful builds.
-
#node ⇒ Constructs::Node
The tree node.
-
#notify_on(id, target, options) ⇒ AWSCDK::CodeStarNotifications::INotificationRule
Defines a CodeStar Notification rule triggered when the project events emitted by you specified, it very similar to
onEventAPI. -
#notify_on_build_failed(id, target, options = nil) ⇒ AWSCDK::CodeStarNotifications::INotificationRule
Defines a CodeStar notification rule which triggers when a build fails.
-
#notify_on_build_succeeded(id, target, options = nil) ⇒ AWSCDK::CodeStarNotifications::INotificationRule
Defines a CodeStar notification rule which triggers when a build completes successfully.
-
#on_build_failed(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines an event rule which triggers when a build fails.
-
#on_build_started(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines an event rule which triggers when a build starts.
-
#on_build_succeeded(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines an event rule which triggers when a build completes successfully.
-
#on_event(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines a CloudWatch event rule triggered when something happens with this project.
-
#on_phase_change(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines a CloudWatch event rule that triggers upon phase change of this build project.
-
#on_state_change(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines a CloudWatch event rule triggered when the build project state changes.
-
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
-
#project_arn ⇒ String
The ARN of the project.
-
#project_name ⇒ String
The name of the project.
-
#project_ref ⇒ AWSCDK::Interfaces::AWSCodebuild::ProjectReference
A reference to a Project resource.
-
#role ⇒ AWSCDK::IAM::IRole?
The IAM role for this project.
-
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
-
#to_string ⇒ String
Returns a string representation of this construct.
-
#with(*mixins) ⇒ Constructs::IConstruct
Applies one or more mixins to this construct.
Constructor Details
#initialize(scope, id, props) ⇒ Project
Returns a new instance of Project.
12 13 14 15 16 17 18 |
# File 'code_build/project.rb', line 12 def initialize(scope, id, props) props = props.is_a?(Hash) ? ::AWSCDK::CodeBuild::ProjectProps.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLlByb2plY3RQcm9wcyJ9")), "props") Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props) end |
Class Method Details
.from_project_arn(scope, id, project_arn) ⇒ AWSCDK::CodeBuild::IProject
67 68 69 70 71 72 |
# File 'code_build/project.rb', line 67 def self.from_project_arn(scope, id, project_arn) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(project_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "projectArn") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_codebuild.Project", "fromProjectArn", [scope, id, project_arn]) end |
.from_project_name(scope, id, project_name) ⇒ AWSCDK::CodeBuild::IProject
Import a Project defined either outside the CDK, or in a different CDK Stack (and exported using the export method).
80 81 82 83 84 85 |
# File 'code_build/project.rb', line 80 def self.from_project_name(scope, id, project_name) Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope") Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(project_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "projectName") Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_codebuild.Project", "fromProjectName", [scope, id, project_name]) end |
.jsii_overridable_methods ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'code_build/project.rb', line 20 def self.jsii_overridable_methods { :node => { kind: :property, name: "node", is_optional: false }, :env => { kind: :property, name: "env", is_optional: false }, :physical_name => { kind: :property, name: "physicalName", is_optional: false }, :stack => { kind: :property, name: "stack", is_optional: false }, :connections => { kind: :property, name: "connections", is_optional: false }, :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false }, :project_arn => { kind: :property, name: "projectArn", is_optional: false }, :project_name => { kind: :property, name: "projectName", is_optional: false }, :project_ref => { kind: :property, name: "projectRef", is_optional: false }, :role => { kind: :property, name: "role", is_optional: true }, :to_string => { kind: :method, name: "toString", is_optional: false }, :with => { kind: :method, name: "with", is_optional: false }, :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false }, :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false }, :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false }, :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false }, :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false }, :add_file_system_location => { kind: :method, name: "addFileSystemLocation", is_optional: false }, :add_secondary_artifact => { kind: :method, name: "addSecondaryArtifact", is_optional: false }, :add_secondary_source => { kind: :method, name: "addSecondarySource", is_optional: false }, :add_to_role_policy => { kind: :method, name: "addToRolePolicy", is_optional: false }, :bind_as_notification_rule_source => { kind: :method, name: "bindAsNotificationRuleSource", is_optional: false }, :bind_to_code_pipeline => { kind: :method, name: "bindToCodePipeline", is_optional: false }, :enable_batch_builds => { kind: :method, name: "enableBatchBuilds", is_optional: false }, :metric => { kind: :method, name: "metric", is_optional: false }, :metric_builds => { kind: :method, name: "metricBuilds", is_optional: false }, :metric_duration => { kind: :method, name: "metricDuration", is_optional: false }, :metric_failed_builds => { kind: :method, name: "metricFailedBuilds", is_optional: false }, :metric_succeeded_builds => { kind: :method, name: "metricSucceededBuilds", is_optional: false }, :notify_on => { kind: :method, name: "notifyOn", is_optional: false }, :notify_on_build_failed => { kind: :method, name: "notifyOnBuildFailed", is_optional: false }, :notify_on_build_succeeded => { kind: :method, name: "notifyOnBuildSucceeded", is_optional: false }, :on_build_failed => { kind: :method, name: "onBuildFailed", is_optional: false }, :on_build_started => { kind: :method, name: "onBuildStarted", is_optional: false }, :on_build_succeeded => { kind: :method, name: "onBuildSucceeded", is_optional: false }, :on_event => { kind: :method, name: "onEvent", is_optional: false }, :on_phase_change => { kind: :method, name: "onPhaseChange", is_optional: false }, :on_state_change => { kind: :method, name: "onStateChange", is_optional: false }, } end |
.PROPERTY_INJECTION_ID ⇒ String
Uniquely identifies this class.
147 148 149 |
# File 'code_build/project.rb', line 147 def self.PROPERTY_INJECTION_ID() Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_codebuild.Project", "PROPERTY_INJECTION_ID") end |
.serialize_env_variables(environment_variables, validate_no_plain_text_secrets = nil, principal = nil) ⇒ Array<AWSCDK::CodeBuild::CfnProject::EnvironmentVariableProperty>
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.
93 94 95 96 97 98 99 |
# File 'code_build/project.rb', line 93 def self.serialize_env_variables(environment_variables, validate_no_plain_text_secrets = nil, principal = nil) environment_variables = environment_variables.is_a?(Hash) ? environment_variables.transform_values { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CodeBuild::BuildEnvironmentVariable.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : environment_variables Jsii::Type.check_type(environment_variables, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jb2RlYnVpbGQuQnVpbGRFbnZpcm9ubWVudFZhcmlhYmxlIn0sImtpbmQiOiJtYXAifX0=")), "environmentVariables") Jsii::Type.check_type(validate_no_plain_text_secrets, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "validateNoPlainTextSecrets") unless validate_no_plain_text_secrets.nil? Jsii::Type.check_type(principal, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "principal") unless principal.nil? Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_codebuild.Project", "serializeEnvVariables", [environment_variables, validate_no_plain_text_secrets, principal]) end |
Instance Method Details
#add_file_system_location(file_system_location) ⇒ void
This method returns an undefined value.
Adds a fileSystemLocation to the Project.
289 290 291 292 |
# File 'code_build/project.rb', line 289 def add_file_system_location(file_system_location) Jsii::Type.check_type(file_system_location, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLklGaWxlU3lzdGVtTG9jYXRpb24ifQ==")), "fileSystemLocation") jsii_call_method("addFileSystemLocation", [file_system_location]) end |
#add_secondary_artifact(secondary_artifact) ⇒ void
This method returns an undefined value.
Adds a secondary artifact to the Project.
299 300 301 302 |
# File 'code_build/project.rb', line 299 def add_secondary_artifact(secondary_artifact) Jsii::Type.check_type(secondary_artifact, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLklBcnRpZmFjdHMifQ==")), "secondaryArtifact") jsii_call_method("addSecondaryArtifact", [secondary_artifact]) end |
#add_secondary_source(secondary_source) ⇒ void
This method returns an undefined value.
Adds a secondary source to the Project.
309 310 311 312 |
# File 'code_build/project.rb', line 309 def add_secondary_source(secondary_source) Jsii::Type.check_type(secondary_source, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLklTb3VyY2UifQ==")), "secondarySource") jsii_call_method("addSecondarySource", [secondary_source]) end |
#add_to_role_policy(statement) ⇒ void
This method returns an undefined value.
Add a permission only if there's a policy attached.
318 319 320 321 |
# File 'code_build/project.rb', line 318 def add_to_role_policy(statement) Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement") jsii_call_method("addToRolePolicy", [statement]) end |
#apply_cross_stack_reference_strength(strength) ⇒ void
This method returns an undefined value.
Override the cross-stack reference strength for this resource.
When set, any cross-stack reference to this resource will use the specified
mechanism instead of the global default determined by the
@aws-cdk/core:defaultCrossStackReferences context key. This is useful for
selectively weakening specific references to avoid the "deadly embrace" problem
without changing the app-wide default.
228 229 230 231 |
# File 'code_build/project.rb', line 228 def apply_cross_stack_reference_strength(strength) Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength") jsii_call_method("applyCrossStackReferenceStrength", [strength]) end |
#apply_removal_policy(policy) ⇒ void
This method returns an undefined value.
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).
245 246 247 248 |
# File 'code_build/project.rb', line 245 def apply_removal_policy(policy) Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") jsii_call_method("applyRemovalPolicy", [policy]) end |
#bind_as_notification_rule_source(_scope) ⇒ AWSCDK::CodeStarNotifications::NotificationRuleSourceConfig
Returns a source configuration for notification rule.
327 328 329 330 |
# File 'code_build/project.rb', line 327 def bind_as_notification_rule_source(_scope) Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope") jsii_call_method("bindAsNotificationRuleSource", [_scope]) end |
#bind_to_code_pipeline(_scope, options) ⇒ void
This method returns an undefined value.
A callback invoked when the given project is added to a CodePipeline.
337 338 339 340 341 342 |
# File 'code_build/project.rb', line 337 def bind_to_code_pipeline(_scope, ) Jsii::Type.check_type(_scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "_scope") = .is_a?(Hash) ? ::AWSCDK::CodeBuild::BindToCodePipelineOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLkJpbmRUb0NvZGVQaXBlbGluZU9wdGlvbnMifQ==")), "options") jsii_call_method("bindToCodePipeline", [_scope, ]) end |
#connections ⇒ AWSCDK::EC2::Connections
Access the Connections object.
Will fail if this Project does not have a VPC set.
156 157 158 |
# File 'code_build/project.rb', line 156 def connections() jsii_get_property("connections") end |
#enable_batch_builds ⇒ AWSCDK::CodeBuild::BatchBuildConfig?
Enable batch builds.
Returns an object contining the batch service role if batch builds could be enabled.
350 351 352 |
# File 'code_build/project.rb', line 350 def enable_batch_builds() jsii_call_method("enableBatchBuilds", []) end |
#env ⇒ AWSCDK::Interfaces::ResourceEnvironment
The environment this resource belongs to.
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.
119 120 121 |
# File 'code_build/project.rb', line 119 def env() jsii_get_property("env") end |
#generate_physical_name ⇒ String
251 252 253 |
# File 'code_build/project.rb', line 251 def generate_physical_name() jsii_call_method("generatePhysicalName", []) end |
#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).
Normally, this token will resolve to arn_attr, but if the resource is
referenced across environments, arn_components will be used to synthesize
a concrete ARN with the resource's physical name. Make sure to reference
this.physicalName in arn_components.
265 266 267 268 269 270 |
# File 'code_build/project.rb', line 265 def get_resource_arn_attribute(arn_attr, arn_components) Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr") arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents") jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components]) end |
#get_resource_name_attribute(name_attr) ⇒ String
Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).
Normally, this token will resolve to name_attr, but if the resource is
referenced across environments, it will be resolved to this.physicalName,
which will be a concrete name.
280 281 282 283 |
# File 'code_build/project.rb', line 280 def get_resource_name_attribute(name_attr) Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr") jsii_call_method("getResourceNameAttribute", [name_attr]) end |
#grant_principal ⇒ AWSCDK::IAM::IPrincipal
The principal to grant permissions to.
163 164 165 |
# File 'code_build/project.rb', line 163 def grant_principal() jsii_get_property("grantPrincipal") end |
#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric
Returns a CloudWatch metric associated with this build project.
357 358 359 360 361 362 |
# File 'code_build/project.rb', line 357 def metric(metric_name, props = nil) Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName") props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metric", [metric_name, props]) end |
#metric_builds(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: sum over 5 minutes
Measures the number of builds triggered.
Units: Count
Valid CloudWatch statistics: Sum
373 374 375 376 377 |
# File 'code_build/project.rb', line 373 def metric_builds(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricBuilds", [props]) end |
#metric_duration(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: average over 5 minutes
Measures the duration of all builds over time.
Units: Seconds
Valid CloudWatch statistics: Average (recommended), Maximum, Minimum
388 389 390 391 392 |
# File 'code_build/project.rb', line 388 def metric_duration(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricDuration", [props]) end |
#metric_failed_builds(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: sum over 5 minutes
Measures the number of builds that failed because of client error or because of a timeout.
Units: Count
Valid CloudWatch statistics: Sum
403 404 405 406 407 |
# File 'code_build/project.rb', line 403 def metric_failed_builds(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricFailedBuilds", [props]) end |
#metric_succeeded_builds(props = nil) ⇒ AWSCDK::CloudWatch::Metric
Default: sum over 5 minutes
Measures the number of successful builds.
Units: Count
Valid CloudWatch statistics: Sum
418 419 420 421 422 |
# File 'code_build/project.rb', line 418 def metric_succeeded_builds(props = nil) props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil? jsii_call_method("metricSucceededBuilds", [props]) end |
#node ⇒ Constructs::Node
The tree node.
104 105 106 |
# File 'code_build/project.rb', line 104 def node() jsii_get_property("node") end |
#notify_on(id, target, options) ⇒ AWSCDK::CodeStarNotifications::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 notify_on_build_succeeded and
notify_on_build_failed to define rules for these specific event emitted.
433 434 435 436 437 438 439 |
# File 'code_build/project.rb', line 433 def notify_on(id, target, ) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXN0YXJub3RpZmljYXRpb25zLklOb3RpZmljYXRpb25SdWxlVGFyZ2V0In0=")), "target") = .is_a?(Hash) ? ::AWSCDK::CodeBuild::ProjectNotifyOnOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZWJ1aWxkLlByb2plY3ROb3RpZnlPbk9wdGlvbnMifQ==")), "options") jsii_call_method("notifyOn", [id, target, ]) end |
#notify_on_build_failed(id, target, options = nil) ⇒ AWSCDK::CodeStarNotifications::INotificationRule
Defines a CodeStar notification rule which triggers when a build fails.
447 448 449 450 451 452 453 |
# File 'code_build/project.rb', line 447 def notify_on_build_failed(id, target, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXN0YXJub3RpZmljYXRpb25zLklOb3RpZmljYXRpb25SdWxlVGFyZ2V0In0=")), "target") = .is_a?(Hash) ? ::AWSCDK::CodeStarNotifications::NotificationRuleOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXN0YXJub3RpZmljYXRpb25zLk5vdGlmaWNhdGlvblJ1bGVPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("notifyOnBuildFailed", [id, target, ]) end |
#notify_on_build_succeeded(id, target, options = nil) ⇒ AWSCDK::CodeStarNotifications::INotificationRule
Defines a CodeStar notification rule which triggers when a build completes successfully.
461 462 463 464 465 466 467 |
# File 'code_build/project.rb', line 461 def notify_on_build_succeeded(id, target, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXN0YXJub3RpZmljYXRpb25zLklOb3RpZmljYXRpb25SdWxlVGFyZ2V0In0=")), "target") = .is_a?(Hash) ? ::AWSCDK::CodeStarNotifications::NotificationRuleOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY29kZXN0YXJub3RpZmljYXRpb25zLk5vdGlmaWNhdGlvblJ1bGVPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("notifyOnBuildSucceeded", [id, target, ]) end |
#on_build_failed(id, options = nil) ⇒ AWSCDK::Events::Rule
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.
477 478 479 480 481 482 |
# File 'code_build/project.rb', line 477 def on_build_failed(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onBuildFailed", [id, ]) end |
#on_build_started(id, options = nil) ⇒ AWSCDK::Events::Rule
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.
492 493 494 495 496 497 |
# File 'code_build/project.rb', line 492 def on_build_started(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onBuildStarted", [id, ]) end |
#on_build_succeeded(id, options = nil) ⇒ AWSCDK::Events::Rule
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.
507 508 509 510 511 512 |
# File 'code_build/project.rb', line 507 def on_build_succeeded(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onBuildSucceeded", [id, ]) end |
#on_event(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines a CloudWatch event rule triggered when something happens with this project.
520 521 522 523 524 525 |
# File 'code_build/project.rb', line 520 def on_event(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onEvent", [id, ]) end |
#on_phase_change(id, options = nil) ⇒ AWSCDK::Events::Rule
Defines a CloudWatch event rule that triggers upon phase change of this build project.
533 534 535 536 537 538 |
# File 'code_build/project.rb', line 533 def on_phase_change(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onPhaseChange", [id, ]) end |
#on_state_change(id, options = nil) ⇒ AWSCDK::Events::Rule
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 on_build_failed and on_build_succeeded 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.
567 568 569 570 571 572 |
# File 'code_build/project.rb', line 567 def on_state_change(id, = nil) Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id") = .is_a?(Hash) ? ::AWSCDK::Events::OnEventOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZXZlbnRzLk9uRXZlbnRPcHRpb25zIn0=")), "options") unless .nil? jsii_call_method("onStateChange", [id, ]) end |
#physical_name ⇒ String
Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
This value will resolve to one of the following:
- a concrete value (e.g.
"my-awesome-bucket") undefined, when a name should be generated by CloudFormation- a concrete name generated automatically during synthesis, in cross-environment scenarios.
133 134 135 |
# File 'code_build/project.rb', line 133 def physical_name() jsii_get_property("physicalName") end |
#project_arn ⇒ String
The ARN of the project.
170 171 172 |
# File 'code_build/project.rb', line 170 def project_arn() jsii_get_property("projectArn") end |
#project_name ⇒ String
The name of the project.
177 178 179 |
# File 'code_build/project.rb', line 177 def project_name() jsii_get_property("projectName") end |
#project_ref ⇒ AWSCDK::Interfaces::AWSCodebuild::ProjectReference
A reference to a Project resource.
184 185 186 |
# File 'code_build/project.rb', line 184 def project_ref() jsii_get_property("projectRef") end |
#role ⇒ AWSCDK::IAM::IRole?
The IAM role for this project.
191 192 193 |
# File 'code_build/project.rb', line 191 def role() jsii_get_property("role") end |
#stack ⇒ AWSCDK::Stack
The stack in which this resource is defined.
140 141 142 |
# File 'code_build/project.rb', line 140 def stack() jsii_get_property("stack") end |
#to_string ⇒ String
Returns a string representation of this construct.
198 199 200 |
# File 'code_build/project.rb', line 198 def to_string() jsii_call_method("toString", []) end |
#with(*mixins) ⇒ Constructs::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.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
211 212 213 214 215 216 |
# File 'code_build/project.rb', line 211 def with(*mixins) mixins.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]") end jsii_call_method("with", [*mixins]) end |