Class BuildSpec
BuildSpec for CodeBuild projects.
Inheritance
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.AWS.CodeBuild.dll
Syntax (csharp)
public abstract class BuildSpec : DeputyBase
Syntax (vb)
Public MustInherit Class BuildSpec
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
// later:
PipelineProject project;
var sourceOutput = new Artifact();
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "Build1",
Input = sourceOutput,
Project = new PipelineProject(this, "Project", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "env", new Dictionary<string, string[]> {
{ "exported-variables", new [] { "MY_VAR" } }
} },
{ "phases", new Dictionary<string, IDictionary<string, string>> {
{ "build", new Struct {
Commands = "export MY_VAR=\"some value\""
} }
} }
})
}),
VariablesNamespace = "MyNamespace"
});
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "MyVar", new BuildEnvironmentVariable {
Value = buildAction.Variable("MY_VAR")
} }
}
});
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
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() | 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
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()
Render the represented BuildSpec.
public abstract string ToBuildSpec()
Returns
System.String