Class: AWSCDK::CodeBuild::CfnProject::EnvironmentVariableProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
code_build/cfn_project.rb

Overview

EnvironmentVariable is a property of the AWS CodeBuild Project Environment property type that specifies the name and value of an environment variable for an AWS CodeBuild project environment. When you use the environment to run a build, these variables are available for your builds to use. EnvironmentVariable contains a list of EnvironmentVariable property types.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, value:, type: nil) ⇒ EnvironmentVariableProperty

Returns a new instance of EnvironmentVariableProperty.

Parameters:

  • name (String)

    The name or key of the environment variable.

  • value (String)

    The value of the environment variable.

  • type (String, nil) (defaults to: nil)

    The type of environment variable. Valid values include:.



1420
1421
1422
1423
1424
1425
1426
1427
# File 'code_build/cfn_project.rb', line 1420

def initialize(name:, value:, type: nil)
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @value = value
  Jsii::Type.check_type(@value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "value")
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type") unless @type.nil?
end

Instance Attribute Details

#nameString (readonly)

The name or key of the environment variable.



1433
1434
1435
# File 'code_build/cfn_project.rb', line 1433

def name
  @name
end

#typeString? (readonly)

The type of environment variable. Valid values include:.

  • PARAMETER_STORE : An environment variable stored in Systems Manager Parameter Store. For environment variables of this type, specify the name of the parameter as the value of the EnvironmentVariable. The parameter value will be substituted for the name at runtime. You can also define Parameter Store environment variables in the buildspec. To learn how to do so, see env/parameter-store in the AWS CodeBuild User Guide .
  • PLAINTEXT : An environment variable in plain text format. This is the default value.
  • SECRETS_MANAGER : An environment variable stored in AWS Secrets Manager . For environment variables of this type, specify the name of the secret as the value of the EnvironmentVariable. The secret value will be substituted for the name at runtime. You can also define AWS Secrets Manager environment variables in the buildspec. To learn how to do so, see env/secrets-manager in the AWS CodeBuild User Guide .


1449
1450
1451
# File 'code_build/cfn_project.rb', line 1449

def type
  @type
end

#valueString (readonly)

The value of the environment variable.

We strongly discourage the use of PLAINTEXT environment variables to store sensitive values, especially AWS secret key IDs. PLAINTEXT environment variables can be displayed in plain text using the AWS CodeBuild console and the AWS CLI . For sensitive values, we recommend you use an environment variable of type PARAMETER_STORE or SECRETS_MANAGER .



1440
1441
1442
# File 'code_build/cfn_project.rb', line 1440

def value
  @value
end

Class Method Details

.jsii_propertiesObject



1451
1452
1453
1454
1455
1456
1457
# File 'code_build/cfn_project.rb', line 1451

def self.jsii_properties
  {
    :name => "name",
    :value => "value",
    :type => "type",
  }
end

Instance Method Details

#to_jsiiObject



1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'code_build/cfn_project.rb', line 1459

def to_jsii
  result = {}
  result.merge!({
    "name" => @name,
    "value" => @value,
    "type" => @type,
  })
  result.compact
end