Show / Hide Table of Contents

Class BuildEnvironmentVariable

Inheritance
object
BuildEnvironmentVariable
Implements
IBuildEnvironmentVariable
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BuildEnvironmentVariable : IBuildEnvironmentVariable
Syntax (vb)
Public Class BuildEnvironmentVariable Implements IBuildEnvironmentVariable
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

BuildEnvironmentVariable()

Properties

Type

The type of environment variable.

Value

The value of the environment variable.

Constructors

BuildEnvironmentVariable()

public BuildEnvironmentVariable()
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")
                    } }
                }
            });

Properties

Type

The type of environment variable.

public BuildEnvironmentVariableType? Type { get; set; }
Property Value

BuildEnvironmentVariableType?

Remarks

Default: PlainText

Value

The value of the environment variable.

public object Value { get; set; }
Property Value

object

Remarks

For plain-text variables (the default), this is the literal value of variable. For SSM parameter variables, pass the name of the parameter here (parameterName property of IParameter). For SecretsManager variables secrets, pass either the secret name (secretName property of ISecret) or the secret ARN (secretArn property of ISecret) here, along with optional SecretsManager qualifiers separated by ':', like the JSON key, or the version or stage (see https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.env.secrets-manager for details).

Implements

IBuildEnvironmentVariable
Back to top Generated by DocFX