Class BuildSpec
BuildSpec for CodeBuild projects.
Inheritance
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class BuildSpec : DeputyBase
Syntax (vb)
Public MustInherit Class BuildSpec
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.CodeBuild;
var codebuildProject = new Project(this, "Project", new ProjectProps {
ProjectName = "MyTestProject",
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string[]>> {
{ "build", new Struct {
Commands = new [] { "echo \"Hello, CodeBuild!\"" }
} }
} }
})
});
var task = new CodeBuildStartBuild(this, "Task", new CodeBuildStartBuildProps {
Project = codebuildProject,
IntegrationPattern = IntegrationPattern.RUN_JOB,
EnvironmentVariablesOverride = new Dictionary<string, BuildEnvironmentVariable> {
{ "ZONE", new BuildEnvironmentVariable {
Type = BuildEnvironmentVariableType.PLAINTEXT,
Value = JsonPath.StringAt("$.envVariables.zone")
} }
}
});
Synopsis
Constructors
BuildSpec() | |
BuildSpec(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
BuildSpec(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
IsImmediate | Whether the buildspec is directly available or deferred until build-time. |
Methods
FromAsset(String) | Use the contents of a local file as the build spec string. |
FromObject(IDictionary<String, Object>) | |
FromObjectToYaml(IDictionary<String, Object>) | Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template. |
FromSourceFilename(String) | Use a file from the source as buildspec. |
ToBuildSpec(Construct) | Render the represented BuildSpec. |
Constructors
BuildSpec()
protected BuildSpec()
BuildSpec(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected BuildSpec(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
BuildSpec(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected BuildSpec(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
IsImmediate
Whether the buildspec is directly available or deferred until build-time.
public abstract bool IsImmediate { get; }
Property Value
System.Boolean
Methods
FromAsset(String)
Use the contents of a local file as the build spec string.
public static BuildSpec FromAsset(string path)
Parameters
- path System.String
Returns
Remarks
Use this if you have a local .yml or .json file that you want to use as the buildspec
FromObject(IDictionary<String, Object>)
public static BuildSpec FromObject(IDictionary<string, object> value)
Parameters
- value System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
FromObjectToYaml(IDictionary<String, Object>)
Create a buildspec from an object that will be rendered as YAML in the resulting CloudFormation template.
public static BuildSpec FromObjectToYaml(IDictionary<string, object> value)
Parameters
- value System.Collections.Generic.IDictionary<System.String, System.Object>
the object containing the buildspec that will be rendered as YAML.
Returns
FromSourceFilename(String)
Use a file from the source as buildspec.
public static BuildSpec FromSourceFilename(string filename)
Parameters
- filename System.String
Returns
Remarks
Use this if you want to use a file different from 'buildspec.yml'`
ToBuildSpec(Construct)
Render the represented BuildSpec.
public abstract string ToBuildSpec(Construct scope = null)
Parameters
- scope Constructs.Construct
Returns
System.String